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 check user is logged in user or user has itil role in "If Activity" of workflow.

vishal jaiswal
Tera Contributor

Scenario: There is a catalog item where a field is "Requested for".

Expected sol: I have to check in workflow that "Requested for" is logged in user OR "Requested for" has Itil role. 

How to achieve this through workflow in "If Activity" ?

 

1 ACCEPTED SOLUTION

akasharora
Mega Expert

Hi Vishal,

 

You can do check using

if( gs.getUserID() == current.variables.requested_for || gs.getUser().getUserByID(current.variables.requested_for).hasRole("itil") )

    return "yes";

else 

   return "no";

 

Thanks,
Akash

View solution in original post

7 REPLIES 7

akasharora
Mega Expert

Hi Vishal,

 

You can do check using

if( gs.getUserID() == current.variables.requested_for || gs.getUser().getUserByID(current.variables.requested_for).hasRole("itil") )

    return "yes";

else 

   return "no";

 

Thanks,
Akash

I tried but not working.

Thanks Akasharora.

Now it works

you're welcome, Vishal.

 

Regards,
Akash