function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jhelblingjhelbling 

Easiest way to retrieve Validation Rule error message from APEX

Hello,

 

For a Unit Test, I need to ensure a validation rule gets correctly fired. I want to avoid having a hard coded string variable within the test containing the message I'm suppose to receive.

 

What is the easiest way, from APEX, in order to parse a Validation Rule metadata and get its error message ?

 

Thanks ouy very much.