Customise standard validation error messages in approval process submission


When a record is submitted for approval from items to approve section/ or through a custom button from visualforce page, if there are any validation errors, Salesforce redirects the user to a new page as shown in below screenshot:




You can customise the error message in trigger using addError() method.  
 
Account acctObj = Trigger.new[0];
  
String errorMessage = 'Click here to go to Account, <a href="https://www.blogger.com/'+URL.getSalesforceBaseUrl().toExternalForm()+'/'+acctObj.Id+'">here</a>';
  
acctObj.addError('<b><span style="color: red;">'+errorBody+'</span></b>');

Comments

Popular posts from this blog

New Beta Architect Certifications by Salesforce

How to deploy Processes in Process builder using ANT?