Skip to content

Commit 6623ff0

Browse files
authored
Merge pull request #12 from salesforcecli/jshackell-message-review
review messages for new generate commands
2 parents 65d40e0 + 4f2a787 commit 6623ff0

9 files changed

Lines changed: 104 additions & 70 deletions

File tree

messages/generate.event.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# summary
22

3-
Generate local metadata for a platform event
3+
Generate metadata source files for a new platform event.
44

55
# description
66

7-
Interactively generate local metadata for a platform object
7+
This command is interactive and must be run in a Salesforce DX project directory. You're required to specify the event's label with the "--label" flag. The command uses this label to provide intelligent suggestions for other event properties, such as its API name.
88

99
# flags.label.summary
1010

11-
The label of the event.
11+
The platform event's label.
1212

1313
# examples
1414

15-
- Create an platform event with the given
15+
- Create a platform event with the specified label:
1616

17-
<%= config.bin %> <%= command.id %> --label "Platform Evt"
17+
<%= config.bin %> <%= command.id %> --label "My Platform Event"
1818

1919
# prompts.publishBehavior
2020

21-
Should events publish after a transaction completes, or immediately
21+
Do you want platform events to publish after a transaction completes, or immediately?

messages/generate.field.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,80 @@
11
# summary
22

3-
Generate local metadata for a custom field on
3+
Generate metadata source files for a new custom field on a specified object.
44

55
# description
66

7-
Interactively generate local metadata for a custom field. This requires that the custom object you're adding the field to be present locally
7+
This command is interactive and must be run in a Salesforce DX project directory. You're required to specify the field's label with the "--label" flag. The command uses this label to provide intelligent suggestions for other field properties, such as its API name.
8+
9+
You can generate a custom field on either a standard object, such as Account, or a custom object. In both cases, the source files for the object must already exist in your local project before you run this command. If you create a relationship field, the source files for the parent object must also exist in your local directory. Use the command "sf metadata retrieve -m CustomObject:<object>" to retrieve source files for both standard and custom objects from your org. To create a custom object, run the "sf generate metadata sobject" command or use the Object Manager UI in your Salesforce org.
810

911
# flags.label.summary
1012

11-
The label of the field.
13+
The field's label.
1214

1315
# flags.object.summary
1416

15-
The directory of the object folder
17+
The directory that contains the object's source files.
1618

1719
# flags.object.description
1820

19-
The directory of object you're adding the field to. Include **c if the object is custom. For example, `force-app/main/default/objects/MyObj**c`
21+
The object source files in your local project are grouped in a directoy with the same name as the object. Custom object names always end in "__c". An example of the object directory for the Account standard object is "force-app/main/default/objects/Account" An example custom object directory is "force-app/main/default/objects/MyObject__c"
2022

21-
If not provided, the command will prompt you to choose from your local objects.
23+
If you don't specify this flag, the command prompts you to choose from your local objects.
2224

2325
# examples
2426

25-
- Create a field with a given Label (you'll be prompted to choose an object)
27+
- Create a field with the specified label; the command prompts you for the object:
2628

27-
<%= config.bin %> <%= command.id %> --label "My Field"
29+
<%= config.bin %> <%= command.id %> --label "My Field"
2830

29-
- Specify a local path to the object's folder
31+
- Specify the local path to the object's folder:
3032

31-
<%= config.bin %> <%= command.id %> --label "My Field" -o force-app/main/default/objects/MyObj\_\_c
33+
<%= config.bin %> <%= command.id %> --label "My Field" --object force-app/main/default/objects/MyObject__c
3234

3335
# prompts.type
3436

35-
Field type
37+
Field type:
3638

3739
# prompts.startingNumber
3840

39-
Starting number
41+
Starting number:
4042

4143
# prompts.defaultValue
4244

43-
Default checkbox value
45+
Default checkbox value:
4446

4547
# prompts.scale
4648

47-
How many decimal places
49+
Number of decimal places:
4850

4951
# prompts.precision
5052

51-
How many total digits, including those decimal places
53+
Total number of digits, including the decimal places:
5254

5355
# prompts.inlineHelpText
5456

55-
User-facing help text (for those bubbles on the record page)
57+
Help text (the text displayed when users hover over the Info icon next to this field):
5658

5759
# prompts.required
5860

59-
Require at the database level on every records (consider requiring on layouts instead!)
61+
Does this field always require a value in order to save a record? (Tip: consider using layouts instead to require a value)
6062

6163
# prompts.externalId
6264

63-
Use this field as an external ID
65+
Should this field be set as the unique record identifier from an external system?
6466

6567
# prompts.securityClassification
6668

67-
Security Classification (how sensitive is this field's content
69+
Security classification (how sensitive is this field's content):
6870

6971
# error.bigObjects
7072

71-
This command does not support big objects.
73+
This command doesn't support big objects.
7274

7375
# error.cmdt
7476

75-
This command does not support Custom Metadata Types
77+
This command doesn't support custom metadata types.
7678

7779
# success
7880

messages/generate.object.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,58 @@
11
# summary
22

3-
Generate local metadata for a custom object
3+
Generate metadata source files for a new custom object.
44

55
# description
66

7-
Interactively generate local metadata for a custom object
7+
This command is interactive and must be run in a Salesforce DX project directory. You're required to specify the object's label with the "--label" flag. The command uses this label to provide intelligent suggestions for other object properties, such as its API name and plural label.
8+
9+
All Salesforce objects are required to have a Name field, so this command also prompts you for the label and type of the Name field. Run the "sf metadata generate field" command to create additional fields for the object.
10+
11+
To reduce the number of prompts, use the "--use-default-features" flag to automatically enable some features, such as reporting and search on the object.
812

913
# flags.label.summary
1014

11-
The label of the object.
15+
The custom object's label.
1216

1317
# flags.use-default-features.summary
1418

1519
Enable all optional features without prompting.
1620

1721
# flags.use-default-features.description
1822

19-
Enables search, feeds, reports, history, activities, bulk API, sharing, and streaming API.
23+
Enables these features:
24+
25+
* Search: Allows users to find the custom object's records when they search, including SOSL.
26+
* Feeds: Enables feed tracking.
27+
* Reports: Allows reporting of the data in the custom object records.
28+
* History: Enables object history tracking.
29+
* Activities: Allows users to associate tasks and scheduled calendar events related to the custom object records.
30+
* Bulk API: With Sharing and Streaming API, classifies the custom object as an Enterprise Application object.
31+
* Sharing: With Bulk API and Streaming API, classifies the custom object as an Enterprise Application object.
32+
* Streaming API: With Bulk API and Sharing, classifies the custom object as an Enterprise Application object.
2033

2134
# examples
2235

23-
- Create an object with a given Label and be prompted for additional information
36+
- Create a custom object with the specified label and be prompted for additional information:
2437

25-
<%= config.bin %> <%= command.id %> --label "My Object"
38+
<%= config.bin %> <%= command.id %> --label "My Object"
2639

27-
- Create an object and opt in to most defaults (see flag help for details)
40+
- Create a custom object and enable optional features without prompting:
2841

29-
<%= config.bin %> <%= command.id %> --label "My Object" --use-default-features
42+
<%= config.bin %> <%= command.id %> --label "My Object" --use-default-features
3043

3144
# success
3245

33-
Created %s
46+
Created %s.
3447

3548
# success.advice
3649

37-
If you deploy the file to a source-tracking org, you will want to retrieve the result since additional properties and defaults will be created in the org
50+
The first time you deploy your new custom object to a source-tracking org, the org creates additional properties and sets new defaults on it. For this reason, we recommend that you immediately retrieve the custom object so your local source files are updated with this new information.
3851

3952
# success.field
4053

41-
Add a field with <%= config.bin %> generate metadata field -o %s -l "Your Field"
54+
Run this command to add a field to your object: sf generate metadata field --object %s --label "Your Field"
4255

4356
# prompts.sharingModel
4457

45-
Org wide sharing model
58+
Org-wide sharing model (default access level for the object's records):

messages/generate.tab.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,38 @@
11
# summary
22

3-
Generate a tab for a custom object.
3+
Generate the metadata source files for a new custom tab on a custom object.
44

55
# description
66

7-
Description of a command.
7+
Custom tabs let you display custom object data or other web content in Salesforce. Custom tabs appear in Salesforce as an item in the app’s navigation bar and in the App Launcher.
8+
9+
This command must be run in a Salesforce DX project directory. You must pass all required information to it with the required flags. The source files for the custom object for which you're generating a tab don't need to exist in your local project.
810

911
# flags.object.summary
1012

11-
API name of the object to generate a tab for.
13+
API name of the custom object you're generating a tab for.
1214

1315
# flags.object.description
1416

15-
API name of the object to generate a tab for. Custom objects should end in \_\_c. The object need not be present in your local source.
17+
The API name for a custom object always ends in "__c", such as "MyObject__c".
1618

1719
# flags.directory.summary
1820

19-
Path to a `tabs` folder that your new tab will be created in.
21+
Path to a "tabs" directory that will contain the source files for your new tab.
2022

2123
# flags.icon.summary
2224

23-
An icon number from <https://lightningdesignsystem.com/icons/#custom> from 1 to 100'
25+
Number from 1 to 100 that specifies the color scheme and icon for the custom tab.
26+
27+
# flags.icon.description
28+
29+
See https://lightningdesignsystem.com/icons/\#custom for the available icons.
2430

2531
# examples
2632

27-
- <%= config.bin %> <%= command.id %> -o MyObj\_\_c -i 54 -d force-app/main/default/tabs
33+
- Create a tab on the MyObject__c custom object:
34+
35+
<%= config.bin %> <%= command.id %> --object MyObject__c --icon 54 --directory force-app/main/default/tabs
2836

2937
# success
3038

messages/prompts.relationship.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
# objectPrompt
22

3-
Which object will be the parent object for this field?
3+
What is the parent object for this relationship field?
44

55
# lookupDeleteConstraint
66

7-
What happens to this field when the parent is deleted
7+
What happens to this field when the parent is deleted?
88

99
# lookupDeleteConstraint.setNull
1010

11-
If the parent record is deleted, the lookup field is cleared.
11+
Clear the value of this field.
1212

1313
# lookupDeleteConstraint.restrict
1414

15-
Prevent the parent record from being deleted if there are lookups that refer to it
15+
Don't allow the parent record from being deleted if there are lookup fields that refer to it.
1616

1717
# lookupDeleteConstraint.cascade
1818

19-
Deletes the lookup record as well as associated lookup fields
19+
Delete the lookup record and the associated lookup fields.
2020

2121
# writeRequiresMasterRead
2222

23-
Allow write access if parent is readable
23+
Allow write access if the parent is readable?
2424

2525
# reparentableMasterDetail
2626

27-
Allow reparenting
27+
Allow reparenting to a different parent record?

messages/prompts.shared.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
11
# directory
22

3-
Where should this new object be created
3+
Which local directory do you want to store the source files for this new object?
44

55
# pluralLabel
66

7-
Plural label
7+
Plural label:
88

99
# apiName
1010

11-
API name
11+
API name (custom objects and fields must end in "__c" and platform events in "__e"):
1212

1313
# description
1414

15-
Description (be kind to your future self or successors!)
15+
Description (great developers write great descriptions):
1616

1717
# error.noDescription
1818

19-
Please enter a description
19+
Please enter a description. Your future self and others will thank you.
2020

2121
# nameFieldPrompts.label
2222

23-
What should the Name field be called
23+
What do you want to call the required Name field?
2424

2525
# nameFieldPrompts.type
2626

27-
Is the name field autonumber or text
27+
What's the type of the required Name field?
2828

2929
# nameFieldPrompts.autoNumberFormat
3030

31-
AutoNumber format
31+
Auto number format:
3232

3333
# object
3434

35-
What object is this field for
35+
Which object is this new field for?
3636

3737
# picklist.first
3838

39-
Add your default picklist value first
39+
Enter the first picklist value, which will also be the default:
4040

4141
# picklist.additional
4242

43-
Enter the next picklist value, or press RETURN to stop adding picklist values
43+
Enter the next picklist value, or press RETURN to stop adding picklist values.
4444

4545
# numberValidationMin
4646

47-
%s is too low. Minimum is %s
47+
%s is too low. Minimum value is %s.
4848

4949
# numberValidationMax
5050

51-
%s is too high. Maximum is %s
51+
%s is too high. Maximum value is %s.

src/commands/generate/metadata/field.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export default class FieldGenerate extends SfCommand<FieldGenerateResult> {
131131
},
132132
// AutoNumber
133133
{
134-
type: 'list',
134+
type: 'number',
135135
message: messages.getMessage('prompts.startingNumber'),
136136

137137
validate: (n: number) => integerValidation(n, 0, Number.MAX_SAFE_INTEGER),
@@ -223,7 +223,7 @@ export default class FieldGenerate extends SfCommand<FieldGenerateResult> {
223223
default: false,
224224
},
225225
{
226-
type: 'choice',
226+
type: 'list',
227227
message: messages.getMessage('prompts.securityClassification'),
228228
name: 'securityClassification',
229229
choices: ['Public', 'Internal', 'Confidential', 'Restricted', 'Mission Critical'],

src/commands/generate/metadata/sobject.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export default class ObjectGenerate extends SfCommand<CustomObjectGenerateResult
116116
const writePath = await writeObjectFile(directory, resultsObject);
117117
this.logSuccess(messages.getMessage('success', [writePath]));
118118
this.info(messages.getMessage('success.field', [dirname(writePath)]));
119-
this.info(messages.getMessage('success.advice'));
119+
this.log();
120120
this.info(messages.getMessage('success.advice'));
121121
return { object: resultsObject, path: writePath };
122122
}

0 commit comments

Comments
 (0)