+ Start a Discussion
Marry SteinMarry Stein 

Apex Trigger: handle validation rules

Hello guys,
 
i am looking for the best way to handle validation rules in apex triggers. Sometimes i want to execute some dml actions after the record is validated. 

Is it possible to query all my validation rules and extract the error condition ? i don't want to translate my validation rules into apex and i am pretty sure, that there is better way to do that.  

Another option is to translate all my validation rules into apex methodes to receive a boolean. So it would be possible to use them in classes and triggers.

I hope you will understand my concers and i am appreciate your help ! 
Rohit RadhakrishnanRohit Radhakrishnan
Validations Rules are calculated before the after triggers. So if your trigger has after event trigger's dml actions are executed after the validations rules are run against the record in context. 
Manas Kanti DattaManas Kanti Datta
Hi Marry,

Can you give some example. why to wan to do validation in apex triggers when validation rules are there - is it complex validation? can you post your problem statement and code.

Thanks,
Manas