Activity Forums Salesforce® Discussions Can you query Validation Rules in salesforce ?

  • Can you query Validation Rules in salesforce ?

    Posted by Ayush on May 14, 2020 at 12:19 PM

    Can you query Validation Rules in salesforce ?

    Anuj replied 6 years ago 3 Members · 2 Replies
  • 2 Replies
  • Kirandeep

    Member
    May 14, 2020 at 12:38 PM

    Hi Ayush ,
    yes we can query Validation Rules with Object names .Something like this :-
    SELECT Id, ValidationName, Active, Description, EntityDefinition.DeveloperName, ErrorDisplayField, ErrorMessage FROM ValidationRule.

  • [adinserter block='9']
  • Anuj

    Member
    May 14, 2020 at 1:07 PM

    Validation Rules are metadata, so are not query-able using Apex / SOQL. You canuse the Metadata API to query for the ValidationRule element

Log In to reply.