Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

approver and requested for same

sarfraz3
Mega Expert

Hi,

I have a requirement in where if "approver" and requested for are same then the approver should not be able to approve the request (like he should be debarred from approval_admin role for that request) ....Please give some solutions...

1 ACCEPTED SOLUTION
14 REPLIES 14

thanks tom....it is showing now..


Nice, good luck!


zica
Giga Guru

Sarfraz,



if you are approving items from a workflow, then


I have a slightly different approach. Use the script section (check Advanced) on the Group Approval activity and remove the requested_by person from the group.



You will need to do a lookup of all group members from sys_user_grmember using a GlideRecord query and skip over the the requested_by approver. Something like this (untested):


answer = getUsers();



function getUsers() {


        var uList = [];


        var gr = new GlideRecord('sys_user_grmember');


        gr.addQuery('group', current.getValue('assignment_group'));


        gr.addQuery('user', '!=', current.requested_by); // may be current.variables.requested_by in your situation


        gr.query();


        while (gr.next()) {


                          uList.push(gr.getValue('user'));


        }


        return uList;


}


cminarich
Kilo Expert

I just had a similar situation.   I wrote a BR to prevent the creation of the approval record if the approver was the same as the requestor.   Hope this helps.



find_real_file.png



find_real_file.png