Sample SOQL:
SELECT ValidationName, Active, EntityDefinition.DeveloperName FROM ValidationRule
Note:
When you use Developer Console, use Tooling API to query.
For more fields, check the below link
Hi, How do we query all validation rules for all objects in an org, the objective is to extract all the validation rules for all the objects(standard and custom) to excel
Use Developer Console and query it. Press CTRL + A and copy the contents. Paste it in a excel file.
Hi Magulan,
Thanks for your response, I have used below query in REST Explorer
query?q=Select+Id,Active,Description,EntityDefinition.DeveloperName,ErrorConditionFormula,+ErrorMessage+From+ValidationRule
When I am using the above query in REST Explorer, I am getting below INVALID_FIELD message: EntityDefinition.DeveloperName,ErrorConditionFormula, ErrorMessage ^ ERROR at Row:1:Column:61 No such column 'ErrorConditionFormula' on entity 'ValidationRule'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names. errorCode: INVALID_FIELD
I am still bit new to SF world 🙂
ErrorConditionFormula is not supported.
Also remove EntityDefinition.DeveloperName.
https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_validationrule.htm
thanks..I thought so 'Query this field only if the query result contains no more than one record. Otherwise, an error is returned. If more than one record exists, use multiple queries to retrieve the records. This limit protects performance.' But is there a way where I can retrieve callout bulk HTTP Get Requests if I have the Validation record Ids..eg:
/services/data/v48.0/tooling/sobjects/ValidationRule/XXXXXXXXXXXXwUQAS
/services/data/v48.0/tooling/sobjects/ValidationRule/XXXXXXXXXXXXXXVQAS
/services/data/v48.0/tooling/sobjects/ValidationRule/XXXXXXXXXXXXX8QAC
or a way to goto the URL..https://xxxxxxxx.my.salesforce.com/xxxxxxxxxxxxwVQAS for each record and grab the fields and its Values.
Somehow your replies are not coming to my email :), I had to visit the page to check for your response:)
You can try composite request if you have series of callouts.
https://help.salesforce.com/articleView?id=000317519&language=en_US&type=1&mode=1
Check this for example – https://www.infallibletechie.com/2020/06/fetching-validation-rule-from-tooling.html