You can use the addError() method for displaying the custom error in the trigger.
Use the below code as reference
try { update accounts; } catch (DMLException e) { for (Account account : accounts) { account.addError('There was a problem updating the accounts'); } }
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_sobject.htm
check this link out.
Hi,
You can use the addError() method for displaying the custom error in the trigger.
Use the below code as reference
try
{
update accounts;
}
catch (DMLException e)
{
for (Account account : accounts)
{
account.addError('There was a problem updating the accounts');
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.