Generate metadata source files for a new custom object.
Description for schema generate sobject
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.
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.
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.
Aliases for schema generate sobject
generate:metadata:sobject
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>‑‑label</code> | <code>‑l</code> | Type: Value<br>Required<br><br>The custom object's label. |
| <code>‑‑use‑default‑features</code> | <code>‑f</code> | Type: Boolean<br><br>Enable all optional features without prompting.<br><br>Enables these features:<br><br><ul><li>Search: Allows users to find the custom object's records when they search, including SOSL.</li><li>Feeds: Enables feed tracking.</li><li>Reports: Allows reporting of the data in the custom object records.</li><li>History: Enables object history tracking.</li><li>Activities: Allows users to associate tasks and scheduled calendar events related to the custom object records.</li><li>Bulk API: With Sharing and Streaming API, classifies the custom object as an Enterprise Application object.</li><li>Sharing: With Bulk API and Streaming API, classifies the custom object as an Enterprise Application object.</li><li>Streaming API: With Bulk API and Sharing, classifies the custom object as an Enterprise Application object.</li></ul> |
Examples for schema generate sobject
Create a custom object with the specified label and be prompted for additional information:
sf schema generate sobject --label "My Object"
Create a custom object and enable optional features without prompting:
sf schema generate sobject --label "My Object" --use-default-features
<!-- prettier-ignore-end -->