schema generate sobject
Generate metadata source files for a new custom object.
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.
generate:metadata:sobject
| Flag Name (Long) | Flag Name (Short) | Description |
|---|---|---|
‑‑flags‑dir | N/A | Type: Value Import flag values from a directory. |
‑‑label | ‑l | Type: Value Required The custom object’s label. |
‑‑use‑default‑features | ‑f | Type: Boolean Enable all optional features without prompting. Enables these features:
|
Create a custom object with the specified label and be prompted for additional information:
Create a custom object and enable optional features without prompting: