- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-14-2018 04:43 AM
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!!!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-14-2018 04:54 AM
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';
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-14-2018 05:01 AM
Hi,
Please use the below script:
answer = ifScript();
function ifScript()
{
var user = current.variables.requester;//Assuming requester is the variable that is storing the value of user who group membership to be checked
var grp_mem = new GlideRecord("sys_user_grmember");
grp_mem.addEncodedQuery("group.active=true^user=" + user);
grp_mem.query();
var count = grp_mem.getRowCount();
if(count > 0)
{
return 'yes';
}
return 'no';
}
Regards,
Ram M