3.7.1 • Published 11 months ago

@shuntaro/sfdx-metadata-generator v3.7.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

sfdx-metadata-generator

SFDX plugin to generate metadata

Version CircleCI Appveyor CI Greenkeeper Known Vulnerabilities Downloads/week License

$ npm install -g @shuntaro/sfdx-metadata-generator
$ sfdx COMMAND
running command...
$ sfdx (--version)
@shuntaro/sfdx-metadata-generator/3.7.1 win32-x64 node-v18.16.0
$ sfdx --help [COMMAND]
USAGE
  $ sfdx COMMAND
...

sfdx metadata:field:convert [-s <string>] [-o <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Converts custom-field-xml-files to a file used to create or update the metadata.

USAGE
  $ sfdx metadata:field:convert [-s <string>] [-o <string>] [--json] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -o, --outputdir=<value>                                                           output directory where metadata are
                                                                                    saved
  -s, --sourcedir=<value>                                                           directory where source files you
                                                                                    convert are stored
  --json                                                                            format output as json
  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

DESCRIPTION
  Converts custom-field-xml-files to a file used to create or update the metadata.

EXAMPLES
  $ sfdx metadata:field:convert --sourcedir ./sourcedir/ --outputdir ./outputdir/

See code: src/commands/metadata/field/convert.ts

sfdx metadata:field:generate [-i <string>] [-o <string>] [-u] [-d <string>] [-p <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Generates custom field metadata converting values in any sort of spreadsheets, e.g., csv and to xml files.

USAGE
  $ sfdx metadata:field:generate [-i <string>] [-o <string>] [-u] [-d <string>] [-p <string>] [--json] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -d, --delimiter=<value>                                                           delimiter for the input file. the
                                                                                    default value is comma
  -i, --input=<value>                                                               input file to be converted to xml
                                                                                    files
  -o, --outputdir=<value>                                                           output directory where metadata are
                                                                                    saved
  -p, --picklistdelimiter=<value>                                                   delimiter for picklist fullNames and
                                                                                    labels. the default value is
                                                                                    semicolon
  -u, --updates                                                                     whether update existing xml files in
                                                                                    outputdir or not
  --json                                                                            format output as json
  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

DESCRIPTION
  Generates custom field metadata converting values in any sort of spreadsheets, e.g., csv and  to xml files.

EXAMPLES
  $ sfdx metadata:field:generate --input ./input.csv --outputdir ./outputdir/

See code: src/commands/metadata/field/generate.ts

sfdx metadata:field:template [-o <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Creates a template input-csv-file.

USAGE
  $ sfdx metadata:field:template [-o <string>] [--json] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -o, --outputdir=<value>                                                           directory where a template csv file
                                                                                    is saved.
  --json                                                                            format output as json
  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

DESCRIPTION
  Creates a template input-csv-file.

EXAMPLES
  $ sfdx metadata:field:template --outputdir ./outputdir/

See code: src/commands/metadata/field/template.ts

sfdx metadata:object:convert [-s <string>] [-o <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Converts custom-object-xml-files to a file used to create or update the metadata.

USAGE
  $ sfdx metadata:object:convert [-s <string>] [-o <string>] [--json] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -o, --outputdir=<value>                                                           output directory where metadata are
                                                                                    saved
  -s, --sourcedir=<value>                                                           directory where source files you
                                                                                    convert are stored
  --json                                                                            format output as json
  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

DESCRIPTION
  Converts custom-object-xml-files to a file used to create or update the metadata.

EXAMPLES
  $ sfdx metadata:object:convert --sourcedir ./sourcedir/ --outputdir ./outputdir/

See code: src/commands/metadata/object/convert.ts

sfdx metadata:object:generate [-i <string>] [-o <string>] [-u] [-d <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Generates custom field metadata converting values in any sort of spreadsheets, e.g., csv and to xml files.

USAGE
  $ sfdx metadata:object:generate [-i <string>] [-o <string>] [-u] [-d <string>] [--json] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -d, --delimiter=<value>                                                           delimiter for the input file. the
                                                                                    default value is comma
  -i, --input=<value>                                                               input file to be converted to xml
                                                                                    files
  -o, --outputdir=<value>                                                           output directory where metadata are
                                                                                    saved
  -u, --updates                                                                     whether update existing xml files in
                                                                                    outputdir or not
  --json                                                                            format output as json
  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

DESCRIPTION
  Generates custom field metadata converting values in any sort of spreadsheets, e.g., csv and  to xml files.

EXAMPLES
  $ sfdx metadata:field:generate --input ./input.csv --outputdir ./outputdir/

See code: src/commands/metadata/object/generate.ts

sfdx metadata:object:template [-o <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Creates a template input-csv-file.

USAGE
  $ sfdx metadata:object:template [-o <string>] [--json] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -o, --outputdir=<value>                                                           directory where a template csv file
                                                                                    is saved.
  --json                                                                            format output as json
  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

DESCRIPTION
  Creates a template input-csv-file.

EXAMPLES
  $ sfdx metadata:object:template --outputdir ./outputdir/

See code: src/commands/metadata/object/template.ts

sfdx metadata:profile:convert [-s <string>] [-o <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Converts custom-profile-xml-files to a file used to update the metadata.

USAGE
  $ sfdx metadata:profile:convert [-s <string>] [-o <string>] [--json] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -o, --outputdir=<value>                                                           output directory where metadata are
                                                                                    saved
  -s, --source=<value>                                                              directory where source files you
                                                                                    convert are stored
  --json                                                                            format output as json
  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

DESCRIPTION
  Converts custom-profile-xml-files to a file used to update the metadata.

EXAMPLES
  $ sfdx metadata:profile:convert --source ./source --outputdir ./outputdir/

See code: src/commands/metadata/profile/convert.ts

sfdx metadata:profile:generate [-i <string>] [-o <string>] [-s <string>] [-d <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Updates profile metadata converting values in any sort of spreadsheets, e.g., csv and to xml files.

USAGE
  $ sfdx metadata:profile:generate [-i <string>] [-o <string>] [-s <string>] [-d <string>] [--json] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -d, --delimiter=<value>                                                           delimiter for the input file. the
                                                                                    default value is comma
  -i, --input=<value>                                                               input file to be converted to xml
                                                                                    files
  -o, --outputdir=<value>                                                           output directory where metadata are
                                                                                    saved
  -s, --source=<value>                                                              directory where source files you
                                                                                    convert are stored
  --json                                                                            format output as json
  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

DESCRIPTION
  Updates profile metadata converting values in any sort of spreadsheets, e.g., csv and  to xml files.

EXAMPLES
  $ sfdx metadata:profile:generate --input ./input.csv --source ./source.profile-meta.xml --outputdir ./outputdir/

See code: src/commands/metadata/profile/generate.ts

How to get started

Make sure you have already installed this plugin.

Field metadata

To start generating field metadata, you need a csv file to include tab names e.g., fullName, label, type, ... , at the header and values for those tags to determine each detail of custom fields from the second line.

Other spreadsheet files are also supported as delimiter flag on the generator command can be any string.

The description of each tag is as follows. For further details of custrom-field-metadata, see https://developer.salesforce.com/docs/atlas.en-us.242.0.api_meta.meta/api_meta/customfield.htm

TagDescription
fullNameCustom field API name.
labelField label name.
descriptionField descritpion.
inlineHelpTextField-level help text.
typeData type. Options are listed below:AutoNumber, Checkbox, Currency, Date, DateTime, Email, Location, Number, Percent, Phone, Picklist, MultiselectPicklist, Text, TextArea, LongTextArea, Html, EncryptedText, Time, Url, Lookup, MasterDetail, ExternalLookup, Summary.
requiredWhether it is required. Options are listed below:true, false.
externalIdWhether it is an external ID. Options are listed below:true, false.
trackHistoryWhether to enableck history tracking. Options are listed below:true, false.
trackTrendingWhether to track historical trending. Options are listed below:true, false.
uniqueWhether it is unique. Options are listed below:true, false.
defaultValueDefault value. For Checkbox data type. Options are listed below:true, false.
displayFormatDisplay format for AutoNumber. Example: A-{0000}.
displayLocationInDecimalWhether to display location in decimal. Options are listed below:true, false.
scaleNumber of decimal places.
precisionNumber of digits.
visibleLinesNumber of visible lines applied to MultiselectPicklist, LongTextArea, and Html.
lengthText length applied to Text, TextArea, LongTextArea, and Html.
maskCharMask character applied to EncryptedText. Options are listed below:asterisk, X.
maskTypeMask type applied to EncryptedText. Options are listed below:all, lastFour, creditCard, nino, ssn, sin.
picklistFullNamePicklist API Names applied to Picklist and MultiselectPicklist. Note that semicolon ';' is used as the default delimiter to separate character string to multiple names. The delimiter can be chenged giving the picklistdelimiter.
picklistLabelPicklist labels applied to Picklist and MultiselectPicklist. Note that semicolon ';' is used as the default delimiter to separate character string to multiple labels. The delimiter can be chenged giving the picklistdelimiter.
caseSensitiveWhether the field is case-sensitive. Applied only for Text. Options are listed below:true, false.
referenceToObject FullName that the object of this field references to.
relationshipLabelLabel for relationship.
relationshipNameChild relationship name applied for Lookup, MasterDetail, and ExternalLookup.
relationshipOrderOrder of master-detail relationship. Options are listed below:0, 1.
deleteConstraintDeletion options for lookup relationships. Options are listed below:Cascade, Restrict, SetNull.
reparentableMasterDetailWhether the child records in a master-detail relationship on a custom object can be reparented to different parent records. Options are listed below:true, false.
writeRequiresMasterReadWhether to allow users with Read access to the primary record permission to create, edit, or delete child records. Options are listed below:true, false.
summaryForeignKeyRepresents the master-detail field on the child that defines the relationship between the parent and the child. Example: ChildObject.ParentObject.
summaryOperationType of operation for roll-up summary field. Options are listed below:count, sum, min, max.
summarizedFieldRepresents the field on the detail row that is being summarized. Example: ChildObject.Field.
summaryFilterItemsFieldRepresents the field to filter items.
summaryFilterItemsOperationType of comparison operation to filter items. Options are listed below:equals,notEqual,lessThan,greaterThan,lessOrEqual,greaterOrEqual,contains,notContain,startsWith,includes,excludes,within.
summaryFilterItemsValueValue to compare with summaryFilterItemsField.

Or you can create a template file running the following commnad:

  $ sfdx metadata:field:template --outputdir ./outputdir/

Then, sfdx metadata:field:generate generates custom field metadata of the input-csv-file.

The flag --input specifies the input-csv-file to be converted to metadata-xml-files and --outputdir the directory to save those xml files.

  $ sfdx metadata:field:generate --input ./input.csv --outputdir ./outputdir/

You can also update custom-field-xml-files with sfdx metadata:field:convert. Assume you have created SFDX project and retrieved field-xml files you want to update. Then, run the following command to rewrite the files in the csv format.

  $ sfdx metadata:field:convert -sourcedir ./force-app/main/default/objects/Account/fields/ --outputdir ../outputdir/

Edit the craeted csv file as you want to update metadata, and then run sfdx metadata:field:generate --updates to override the xml files.

Note that runnning without --updates avoids overrinding existing metadata.

  $ sfdx metadata:field:generate --input ./input.csv --outputdir ./outputdir/ --updates

Object metadata

To start generating object metadata, you need a csv file to include tab names e.g., fullName, label, allowInChatterGroups, ... , at the header and values for those tags to determine each detail of custom objects from the second line.

Other spreadsheet files are also supported as delimiter flag on the generator command can be any string.

The description of each tag is as follows. For further details of custrom-object-metadata, see https://developer.salesforce.com/docs/atlas.en-us.242.0.api_meta.meta/api_meta/customobject.htm

TagDescription
fullNameCustom object API name.
labelCustom object label name.
descriptionObject descritpion.
allowInChatterGroupsWhether to allow records of this custom object type to be added to Chatter groups. Options are listed below:true, false.
deploymentStatusDeployment status. Options are listed below:Deployed, InDevelopment.
enableActivitiesWhether to enable activities. Options are listed below:true, false.
enableBulkApiWhether to enable bulk API. Options are listed below:true, false.
enableHistoryWhether to enable history. Options are listed below:true, false.
enableReportsWhether to enable reports. Options are listed below:true, false.
enableSearchWhether to enable search. Options are listed below:true, false.
enableSharingWhether to enable sharing. Options are listed below:true, false.
enableStreamingApiWhether to enable sreaming API. Options are listed below:true, false.
nameFieldTypeType of name field. Options are listed below:Text, AutoNumber.
nameFieldLabelLabel for name field.
nameFieldDisplayFormatName field display format. Applied when nameFieldType is set to AutoNumber.

Or you can create a template file running the following commnad:

  $ sfdx metadata:object:template --outputdir ./outputdir/

Then, sfdx metadata:object:generate generates custom object metadata of the input-csv-file.

The flag --input specifies the input-csv-file to be converted to metadata-xml-files and --outputdir the directory to save those xml files.

  $ sfdx metadata:object:generate --input ./input.csv --outputdir ./outputdir/

You can also update custom-object-xml-files with sfdx metadata:object:convert. Assume you have created SFDX project and retrieved object-xml files you want to update. Then, run the following command to rewrite the files in the csv format.

  $ sfdx metadata:object:convert -sourcedir ./force-app/main/default/objects/ --outputdir ../outputdir/

Edit the craeted csv file as you want to update metadata, and then run sfdx metadata:object:generate --updates to override the xml files.

Note that runnning without --updates avoids overrinding existing metadata.

  $ sfdx metadata:object:generate --input ./input.csv --outputdir ./outputdir/ --updates

Profile metadata

Only update is supported for profile metadata due to dependencies on other metadata.

You can rewrite a profile xml file in the csv format as shown in field metadata by runnning metadata:field:convert.

  $ sfdx metadata:field:convert -sourcedir ./force-app/main/default/profiles/xxx.profile-meta.xml --outputdir ../outputdir/

Edit the craeted csv file as you want to update metadata. The description of the output csv file is as follows. For further details of profile-metadata, see https://developer.salesforce.com/docs/atlas.en-us.242.0.api_meta.meta/api_meta/meta_profile.htm

TagDescription
fullNameFullName to update.
typeField Name to update. Options are listed below:applicationVisibilities, classAccesses, fieldPermissions, objectPermissions, pageAccesses, recordTypeVisibilities, tabVisibilities, userPermissions.
editableWhether it is allowed to edit the field of fullName. Options are listed below:true, false.
readableWhether it is allowed to read the field of fullName. Options are listed below:true, false.
allowCreateWhether it is allowed to create the object of fullName. Options are listed below:true, false.
allowDeleteWhether it is allowed to delete the object of fullName. Options are listed below:true, false.
allowEditWhether it is allowed to edit the object of fullName. Options are listed below:true, false.
allowReadWhether it is allowed to read the object of fullName. Options are listed below:true, false.
modifyAllRecordsWhether it is allowed to modify all records of the object of fullName.Options are listed below:true, false.
viewAllRecordsWhether it is allowed to view all records of the object of fullName. Options are listed below:true, false.
defaultWhether it is default. Applied for applicationVisibilities and recordTypeVisibilities. Options are listed below:true, false.
visibleWhether it is visible. Applied for applicationVisibilities and recordTypeVisibilities. Options are listed below:true, false.
enabledWhether it is enabled. Applied for classAccesses, pageAccesses, and userPermissions. Options are listed below:true, false.
visibilityType of tag-visibility. Applied for tabVisibilities. Options are listed below:DefaultOn, DefaultOff,Hidden

Then, run sfdx metadata:profile:generate --updates to override the profile xml file.

  $ sfdx metadata:profile:generate --input ./input.csv --outputdir ../outputdir/
3.7.1

11 months ago

3.7.0

11 months ago

3.6.1

11 months ago

3.6.0

11 months ago

3.5.3

11 months ago

3.5.2

11 months ago

3.5.1

11 months ago

3.5.0

11 months ago

3.4.0

11 months ago

3.2.0

11 months ago

3.1.0

11 months ago

3.0.4

12 months ago