+ Start a Discussion
Rajesh-SFDCRajesh-SFDC 

Error Message Required Before Submiting for Approval

Hi everybody,

Is there any way to put custom error message based on some field criteria before submitting for Approval .

Let's say i have field A if it is blank and when i submit for approval then i want custome error message to be dislayed !

Thanks in advance !
Laxman Vattam 26Laxman Vattam 26
You can add javascript on the button itself to check various conditions and throw merror messages before submitting it for approval. 
Laxman Vattam 26Laxman Vattam 26
Once all the conditions pass, you can submit the record for approval process by calling apex class
Rajesh-SFDCRajesh-SFDC
Hi Laxman,

Can you give me snips of the code how to add on submit approval button and it will not affect the existing functionality

Regards,
Rajesh
Laxman Vattam 26Laxman Vattam 26
Refere https://developer.salesforce.com/docs/atlas.en-us.workbook.meta/workbook/button_intro.htm for step by step process for calling a apex method from java script in a button

Refer https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_process_example.htm to get the syntax for submitting a record to approval process using apex