Find your content:

Search form

You are here

Making Approval Comment Mandatory

 
Share

Is it possible to make approval comments mandatory? There is one discussed here. http://christopheralunlewis.blogspot.in/2012/09/making-rejection-comments-mandatory-in.html

I've a two step approval process but I don't get comments in my trigger(pi.Steps[0].Comments).

Am I missing something here?


Attribution to: Vignesh Damodharan

Possible Suggestion/Solution #1

I see the code working fine!!!

I tried to do the same from the demo and when I tried to reject a record i got the following error : Validation Errors While Saving Record(s) There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Operation Cancelled: Please provide a rejection reason!".

Some assumptions(could be silly) 1) Did you activate the approval process,if so check in the dev console to see if the entry criteria is evaluating to true. 2) You modified the trigger to point to the right custom object(some people do the workbook exercise in their dev org and the invoice object is on of the objects, just an assumption) 3) Did you do three workflow updates 1) approval update 2) pending update 3) rejection update?

These are some of the points I missed hopefully this is one of them you missed too. As for the code thanks for the link,another keep safe code :). works beautiful.


Attribution to: Rao

Possible Suggestion/Solution #2

Thanks for looking at my blog post.

From looking at your question, may I ask first, are you looking to make comments mandatory for approvals, rejections or both? In my example I only make comments mandatory on rejections. If you are looking to do this for approvals or both, then you would need to adjust the trigger code accordingly, including altering the SOQL query so it looks at approval messages for comments as well.

The fact that the approval process is a two step is not important, as the final rejection and approval methods fire the trigger. I just tested it out on a two step process and it worked as intended.

I hope that helps! If not please post your code with a bit more info and I will see how I can help.

Update 8/10/2012: I have an updated version of my mandatory comments technique that accounts for all steps in an approval steps in a process. I have written a blog post that explains how to do this.


Attribution to: Christopher Alun Lewis
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/1751

My Block Status

My Block Content