Create Salesforce Validation Rule
sf_create_validation_ruleCreate or update Salesforce validation rules on any object via Metadata API. Define error formulas that return TRUE for invalid data to enforce data quality.
Instructions
Creates or updates a Salesforce Validation Rule on any object via the Metadata API. The errorConditionFormula returns TRUE when data is INVALID. Use for data quality enforcement.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| active | No | Whether the rule is active | |
| ruleName | Yes | API name for the rule, e.g. 'Require_Close_Date' | |
| objectName | Yes | Object API name, e.g. 'Account', 'Opportunity', 'Invoice__c' | |
| description | No | Description of this validation rule | |
| errorMessage | Yes | Error shown to user when validation fails (max 255 chars) | |
| errorDisplayField | No | Field API name to display error next to, e.g. 'CloseDate'. Blank = top of page. | |
| errorConditionFormula | Yes | Formula returning TRUE when data is INVALID, e.g. "AND(ISPICKVAL(StageName,'Closed Won'),ISBLANK(CloseDate))" |