[SalesForce] Salesforce Tooling API for ValidationRule

I am trying to update ValidationRules via the tooling API via PATCH and the endpoint: /services/data/v33.0/tooling/sobjects/ValidationRule/{Id}

Every time I try to update a field i get this error and cannot figure it out:

Request Body: {"Description": "testing…."}
Error: message: You must provide a valid Metadata field for ValidationFormula
errorCode: REQUIRED_FIELD_MISSING

I cannot seem to find the field for ValidationFormula..

UPDATE: I am doing this all via the workbench. I am using the PATCH http method with the following URI and Body:

URI: /services/data/v33.0/tooling/sobjects/ValidationRule/03di00000006TPHAA2
BODY: {"Description": "testing...."}

Best Answer

Only the Metadata and FullName fields can be updated. Description tag should be included in Metadata as below. Also, include other required Metadata fields and its values. Below request successfully updated the validation rule using Workbench PATCH method.

Request Body:

{
    "Metadata": {
        "description": "Updated via WorkBench",
        "active": true,
        "errorConditionFormula": "NOT(ISNULL(TestField__c))",
        "errorMessage": "Test message"
    }
}
Related Topic