+ 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.