Make approval comments mandatory when approved by approval admin?

Nolan3
Mega Guru

Hello,

I was wondering if any one knows a way to make approval comments field mandatory when an approval admin is approving something that they are not listed as the approver?  

I am running Helsinki Patch 10 and see the UI Policy to make this field mandatory when an approval is rejected but don't see any conditions that allow me to create another UI policy that will only set mandatory when someone other then the original approver does the approval.

thank you for your help in advance!

1 ACCEPTED SOLUTION

saprem_d
Giga Guru

Hello,



Write a before update business rule on sysapproval_approver table as below



conditon: current.state changes to "Approved"



script:



if(gs.getUserID() != current.approver && gs.hasRole('approval_admin'))


if(current.comments == '') {


gs.addInfoMessage('Comments needs to be filled');


current.setAbortAction(true);


}


View solution in original post

4 REPLIES 4

saprem_d
Giga Guru

Hello,



Write a before update business rule on sysapproval_approver table as below



conditon: current.state changes to "Approved"



script:



if(gs.getUserID() != current.approver && gs.hasRole('approval_admin'))


if(current.comments == '') {


gs.addInfoMessage('Comments needs to be filled');


current.setAbortAction(true);


}


Thank you Saprem that did the trick.  


SanjivMeher
Kilo Patron
Kilo Patron

Hi Nolan,



You can write a business rule to do so. Add a condition in business rule, approver != javascript:gs.getUser.getID()


Then you can check in the business rule script to check, if comments is empty, set abort action on the current record displaying error message 'Comments are mandatory'



Please mark this response as correct or helpful if it assisted you with your question.

Hello Sanjiv,



Thanks for commenting appreciate the help!