Play Games

Search This Blog

Wednesday, May 1, 2024

How to query the validation rules of an object in salesforce - Salesforce Globe 4u

Solution: Using tooling api ,the validation rules can be queried.

Example: Use the following query in developer console by enabling the tooling api

SELECT Id, Active, Description, EntityDefinition.QualifiedApiName, ErrorDisplayField, ErrorMessage,ValidationName FROM ValidationRule

Output:



To filter validation rules for a specific object, use EntityDefinition.QualifiedApiName(object api name) in where clause of query 

Example:

SELECT Id, Active, Description, EntityDefinition.QualifiedApiName, ErrorDisplayField, ErrorMessage,ValidationName FROM ValidationRule where EntityDefinition.QualifiedAPiName='A__c'

Output:



No comments:

Post a Comment