cmdt generate object

<!-- prettier-ignore-start -->

Generate a new custom metadata type in the current project.

Description for cmdt generate object

This command creates a metadata file that describes the new custom metadata type. By default, the file is created in the MyCustomType__mdt directory in the current directory, where MyCustomType is the value of the required --type-name flag. Use the --output-directory to generate the file in a package directory with other custom metadata types, such as "force-app/main/default/objects".

Aliases for cmdt generate object

force:cmdt:create

cmdt:create

Flags

Flag Name (Long) Flag Name (Short) Description
<code>‑‑flags‑dir</code> N/A Type: Value<br><br>Import flag values from a directory.
<code>‑‑json</code> N/A Type: Boolean<br><br>Format output as json.
<code>‑‑label</code> <code>‑l</code> Type: Value<br><br>Label for the custom metadata type.
<code>‑‑output‑directory</code> <code>‑d</code> Type: Value<br><br>Directory to store the newly-created custom metadata type files<br><br>The location can be an absolute path or relative to the current working directory. The default is the current directory.
<code>‑‑plural‑label</code> <code>‑p</code> Type: Value<br><br>Plural version of the label value; if blank, uses label.
<code>‑‑type‑name</code> <code>‑n</code> Type: Value<br>Required<br><br>Unique object name for the custom metadata type.<br><br>The name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.
<code>‑‑visibility</code> <code>‑v</code> Type: Value<br>Valid Values: PackageProtected, Protected, Public<br>Default value: Public<br><br>Who can see the custom metadata type.<br><br>For more information on what each option means, see this topic in Salesforce Help: https://help.salesforce.com/s/articleView?id=sf.custommetadatatypes_ui_create.htm&type=5.

Examples for cmdt generate object

Generate a custom metadata type with developer name 'MyCustomType'; this name is also used as the label:

sf cmdt generate object --type-name MyCustomType

Generate a protected custom metadata type with a specific label:

sf cmdt generate object --type-name MyCustomType --label "Custom Type" --plural-label "Custom Types" --visibility Protected
<!-- prettier-ignore-end -->