1

I need to retrieve all the validation rules associated with a given object, using the REST API.

Looking in doc/forums, I've found that I could retrieve validation rules associated with an object using the following query:

https:///services/data/v35.0/tooling/query?q=Select Id,Active,Description,ErrorDisplayField, ErrorMessage From ValidationRule Where EntityDefinitionId = 'xxxxx'

The problem is that I don't have the object'ID needed to filter, I only have its name. Is there any way to filter using the object's name?

Another alternative seems to be getting the object'ID, but it seems that Metadata REST API (i.e. describe) does not return it.

Any help on this is very appreciated.

Mariana

1

1 Answer 1

1

Please use the below solution in workbench via REST explorer & method as "GET".

/services/data/v43.0/tooling/query?q=Select+Id,Active,Description,EntityDefinition.DeveloperName,ErrorConditionFormula,+ErrorMessage+From+ValidationRule+where+EntityDefinition.DeveloperName+=+'Lead'

Thanks!

1
  • ErrorConditionFormula is not a field available on the ValidationRule object. My guess is you'll have to individually query validation rules and then use the ErrorConditionFormula field from the associated metadata Mar 7 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.