# cmdt generate object

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                                                                                                                                                                                                                                                                                                                                      |
| -------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `--flags-dir`        | N/A               | **Type:** Value<br><br>Import flag values from a directory.                                                                                                                                                                                                                                                                                      |
| `--json`             | N/A               | **Type:** Boolean<br><br>Format output as json.                                                                                                                                                                                                                                                                                                  |
| `--label`            | `-l`              | **Type:** Value<br><br>Label for the custom metadata type.                                                                                                                                                                                                                                                                                       |
| `--output-directory` | `-d`              | **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.                                                                                                                           |
| `--plural-label`     | `-p`              | **Type:** Value<br><br>Plural version of the label value; if blank, uses label.                                                                                                                                                                                                                                                                  |
| `--type-name`        | `-n`              | **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.                      |
| `--visibility`       | `-v`              | **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:

```shell
sf cmdt generate object --type-name MyCustomType
```

Generate a protected custom metadata type with a specific label:

```shell
sf cmdt generate object --type-name MyCustomType --label "Custom Type" --plural-label "Custom Types" --visibility Protected
```
