Excluding approver from group approval if they are also requester of the ticket

SNNoob
Tera Expert

Hello! I have a form where users can order an item. One of the variables is the "requested for" variable. After they submit the order, an approval is sent to a group, where anyone of the group members can approve the request. However, if the requester is a part of this approval group, they can approve the request themselves.

 

I want to prevent this, so that the group approval would exclude a member of the group if they are also the requester on the ticket that needs approving. The current approval logic is built in Flow Designer, using the Ask for Approval action step that comes out of the box in ServiceNow. Is there some way to achieve this?

4 REPLIES 4

Uncle Rob
Kilo Patron

So there's two possibilities
1)  If I have the power to approve this, then I SKIP the approval step (approval assumed)

2)  If I have the power to approve this, I still need approval, but I must be excluded.  (approval from peers).

 

It sounds like you want 2.  Is that correct?

Hi Robert, thanks for your reply. Correct, 2nd scenario is the one in question here. I do not wish to skip the approval.

KSchooler
Tera Contributor

We are looking to solve this same issue where the peer approval is still required (you cannot approve your own request yet you are a member of the approval group and need to be excluded.)

Vasu ch
Kilo Sage

Hi @SNNoob @KSchooler 

 

I just came across the similar requirement. To achieve this I used scripting for the rules in Ask Approval flow action. It's working fine for me.

var temp = "";
var req_for = fd_data.trigger.request_item.requested_for.sys_id;

var obj = new GlideRecord("sys_user_grmember");
obj.addQuery("group","1fbf74279762b110a28ffcdfe153afa6");  // My test approval group
obj.query();
while(obj.next()){
	if (obj.user != req_for){
		temp += obj.user+",";
	}
}
sys_ids = temp.slice(0,-1);
return "ApprovesRejectsAnyU["+sys_ids+"]";

 I followed this post to configure the scripted approvals: https://www.servicenow.com/community/now-platform-blog/scripted-approvals-in-flow-designer-with-flow...

 

Regards,

Vasu Cheeli