Create Salesforce Custom Field
sf_create_custom_fieldCreate custom fields on any Salesforce object with various types like Text, Number, Picklist, and Lookup, while ensuring API names end with '__c'.
Instructions
Creates a new custom field on an existing Salesforce object. The field API name must end with '__c'. Supports all field types: Text, Number, Picklist, Lookup, etc.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | Salesforce field type | |
| label | Yes | Display label for the field, e.g. 'Status' | |
| scale | No | Decimal places for Number/Currency/Percent (0–17) | |
| length | No | Max length. Text/TextArea: 1–255 (default 255). LongTextArea/Html (Text Area Long / Rich Text Area): 256–131072 (default 32768). | |
| unique | No | Whether values must be unique (Text, Number, Email) | |
| required | No | Whether the field is required on page layouts | |
| fieldName | Yes | API name of the field, e.g. 'Status__c' | |
| precision | No | Total digits for Number/Currency/Percent (1–18) | |
| externalId | No | Whether this field is an external ID | |
| objectName | Yes | API name of the parent object, e.g. 'Account' or 'Invoice__c' | |
| description | No | Optional description for the field | |
| referenceTo | No | Target object API name for Lookup/MasterDetail, e.g. 'Account' | |
| defaultValue | No | Default value for the field. Use true/false for Checkbox fields. | |
| visibleLines | No | Visible lines. Required for LongTextArea and Html (Text Area Long / Rich Text Area) — default 10. Also used for MultiselectPicklist. | |
| picklistValues | No | Picklist configuration. Required for Picklist / MultiselectPicklist types. | |
| deleteConstraint | No | Delete behaviour for Lookup fields: 'Cascade', 'Restrict', or 'SetNull' | |
| relationshipName | No | API name for the relationship (no spaces) | |
| relationshipLabel | No | Label for the relationship on the related object |