We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

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

Not applicable

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

Not applicable

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

Not applicable

you're welcome, Vishal.

 

Regards,
Akash