+ Start a Discussion
SF DEVSF DEV 

How to catch and display error message from trigger

using '' try catch'' i want to display the error message from the catch(exception e) code on to the layout when trigger gets fired.

 

How to show the error message on layout??

Best Answer chosen by Admin (Salesforce Developers) 
Coco_SdyneyCoco_Sdyney

correct, in catch, you will need to write like

 

trigger.new[0].addError('something wrong etc.');

All Answers

SF DEVSF DEV

I want to display error from

 

 catch(exception e)

{

adderror(e)

}

like this !!!

Coco_SdyneyCoco_Sdyney

correct, in catch, you will need to write like

 

trigger.new[0].addError('something wrong etc.');

This was selected as the best answer