1

I want a solution to understand how we use metadata API to get a list of validation rules in which a particular field api is present

marked as duplicate by Gortonington, battery.cord, Derek F, Jayant Das, glls Mar 6 at 19:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

You don't have to use Metadata API for your purposes. You can use Tooling API. First, you can query all Validation Rules in your org with only Id field to create a set if its Ids:

/services/data/v45.0/tooling/query/?q=SELECT+Id+FROM+ValidationRule

Then you can query Validation Rule with Metadata and FullName fields for each available Validation Rule Id because when we're retrieving results with Metadata or FullName fields, the query qualifications must specify no more than one row for retrieval:

/services/data/v45.0/tooling/query?q=Select+Metadata,FullName+FROM+ValidationRule+WHERE+Id='IdFromOurSet'

Metadata field of each returned Validation Rule record contains text field errorConditionFormula in which you can search your desirable field API name.

For more details please read Tooling API | ValidationRule

  • hey Oleh, I have already found the solution using Tooling API now working with Metadata API – Gitika Chandnani Apr 16 at 9:18

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