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
AbAb 

Display error message to user on screen ifexception is raised in trigger

Hello,

If i have a triggers on account,
If the trigger goes in exception loop, i want to display a error mesage "not valied" on the page and halt further proceeding of the page, i mean not let the user to save the page..

how can this be done
Best Answer chosen by Ab
swati_sehrawatswati_sehrawat
try{
	//Do code
}catch(Exception e){
	trigger.new[0].addError('Error Message.');
}


 

This can help

All Answers

Aniket Malvankar 10Aniket Malvankar 10
Hello Sandrine,

You can .addError(''XYZ);
swati_sehrawatswati_sehrawat
try{
	//Do code
}catch(Exception e){
	trigger.new[0].addError('Error Message.');
}


 

This can help

This was selected as the best answer