---
schema_version: "1"
id: 65183b70c475e89dc05cfd2da3ab02281f89cf55bac6383d06d33aef5e6cc773
title: cmdt generate object
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfclireference/guides/cmdt/cli_reference_cmdt_generate_object.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_cmdt_generate_object.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 6e2670907fa2d938c1d0e5497bfd58a0026901a4b57b5067f32c00a4d59ac82b
products:
  - Salesforce CLI Command Reference
  - salesforcedx
---
<!-- prettier-ignore-start -->

# 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 |
|------------------|-------------------|-------------|
| <code>&#8209;&#8209;flags&#8209;dir</code> | N/A | **Type:** Value<br><br>Import flag values from a directory. |
| <code>&#8209;&#8209;json</code> | N/A | **Type:** Boolean<br><br>Format output as json. |
| <code>&#8209;&#8209;label</code> | <code>&#8209;l</code> | **Type:** Value<br><br>Label for the custom metadata type. |
| <code>&#8209;&#8209;output&#8209;directory</code> | <code>&#8209;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>&#8209;&#8209;plural&#8209;label</code> | <code>&#8209;p</code> | **Type:** Value<br><br>Plural version of the label value; if blank, uses label. |
| <code>&#8209;&#8209;type&#8209;name</code> | <code>&#8209;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>&#8209;&#8209;visibility</code> | <code>&#8209;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:

```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
```
<!-- prettier-ignore-end -->
