Auto-approve request when the User itself is the approver of the request in Service catalog.

navneet10
Mega Contributor

Hi All,

If the line manager raise the request of behalf of his reportee and for the same request ,the line manager is the Approver also.

 

In this case Request should get Auto approved.How to achive this ? Please support.

Ex.

User A raise the request,the request will go to his manager[User M] for approval .It is fine.

Now when User M raise request on behalf of User A,then the request should get auto approved.as User M is the Approver.

5 REPLIES 5

Ziaur Rahman1
Tera Expert

Hello Navneet, 

 

You can add an "If activity" before the Approval activity, In the If activity you can confirm that If user is approver itself then output should leave the approval activity and If not then output should go to approval activity. 

If you can send screenshot of your workflow and details of the approval activity and then I can write script for IF activity for you. 

 

Thanks

Ziaur Rahman

Shishir Srivast
Mega Sage

You can use the if and setValue activity to check if requested_by is a manager of requested_for then you can use the setValue activity to set the status to approved.

May be you can try with below script in if activity, if result is yes then set to Set Value activity else send to Approval Activity.

 

answer = ifScript();
function ifScript() {
	var gr = new GlideRecord('sys_user');
	gr.get(current.request.requested_for);
	if(gr.manager == current.opened_by)
		return 'yes';
	return 'no';
}

Thanks Shishir, Let me try this ,Can you confirm ,if It return yes then it will go the SET as approved? and no then it will go for waiting for approval ?

Right

find_real_file.png