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.

Check group membership in workflow activity

maneesh3
Tera Contributor

Hi,

I need kind help in a script for a workflow IF condition where it will check RITM End user is an member of an particular group then it will be YES and NO in other case. From there I will connect this to next activity for a approval process.

After ordering in catalog form, once RITM is raised then this IF condition should check RITM End user is a part of a group and then the answer is YES or else NO. 

Thanks a lot for the help!!!

 

1 ACCEPTED SOLUTION

Maniraj Jayaraj
Tera Expert

you can use script directly as you use in any other server side scripts:

 

in the Workflow IF activity try the below code:

 

var ourUser = gs.getUser().­getUserByID(current.requester);//current.requester - end user in RITM

answer = ifScript();

function ifScript()
{
if(­ourUser.­isMemberOf(group sysid/name))
{
return 'yes';
}
return 'no';
}

View solution in original post

5 REPLIES 5

Maniraj Jayaraj
Tera Expert

you can use script directly as you use in any other server side scripts:

 

in the Workflow IF activity try the below code:

 

var ourUser = gs.getUser().­getUserByID(current.requester);//current.requester - end user in RITM

answer = ifScript();

function ifScript()
{
if(­ourUser.­isMemberOf(group sysid/name))
{
return 'yes';
}
return 'no';
}

Thanks  lot. It worked great

Awesome.  Works like a charm. Thanks very much Maniraj!

Worked perfectly. Thank you @Maniraj Jayaraj !!