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.

How to skip RITM approval if Manager is the Requested By

Joe Weisiger
Giga Expert

Hello,

I have a catalog item where I have created a reference variable called "Requested by".  If this field is the same user that the approval is going to I want the approval skipped.  

How do I accomplish this?

Thank you in advance!

Joe

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Joe Weisiger 

You can use If activity with script just before your actual approval and return yes or no

if activity script

answer = ifScript();

function ifScript(){

// your logic to determine the approver here

var approver = 'your value';

if(current.request.requested_for == approver)

return 'no'; // output of this goes to next activity by skipping approval

else

return 'yes'; // output of this goes to approval activity

}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

12 REPLIES 12

ccajohnson
Kilo Sage

What I like to do when I have complex logic for approvals is to remove the approval logic to a script include so I can call it and perform all of my checks before generating the approval. Let me know if this sounds like something you want to try and I will look up my previous solution.

Thanks for the reply!

I was hoping to keep it simple and be able to do it in the 'When To Run' condition on the approval activity.

 - Approver - Is Not - current.variables.requested_by

I just don't see a way to select "Approver".  Do you know if this is possible?

It all depends upon who is approving it. The only reason why I choose to do it outside of the workflow is so it can be used in multiple workflows.

Pranesh072
Mega Sage

Can you share the approval activity?