---
schema_version: "1"
id: 3cec8654f1328b29c928d82cde6d5a0a1294b2393a951de3ea54c8ccf7dd2f69
title: schema generate sobject
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfclireference/guides/schema/cli_reference_schema_generate_sobject.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_schema_generate_sobject.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 17341184ad4da09dab5dc0dbfd6db4b0977a5d8a1b3d3cab3875dde5513953fb
products:
  - Salesforce CLI Command Reference
  - salesforcedx
---
<!-- prettier-ignore-start -->

# schema generate sobject

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>&#8209;&#8209;flags&#8209;dir</code> | N/A | **Type:** Value<br><br>Import flag values from a directory. |
| <code>&#8209;&#8209;label</code> | <code>&#8209;l</code> | **Type:** Value<br>**Required**<br><br>The custom object's label. |
| <code>&#8209;&#8209;use&#8209;default&#8209;features</code> | <code>&#8209;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:

```shell
sf schema generate sobject --label "My Object"
```

Create a custom object and enable optional features without prompting:

```shell
sf schema generate sobject --label "My Object" --use-default-features
```
<!-- prettier-ignore-end -->
