- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2022 10:23 PM
Hello,
I want to check if the RITM opened by field user is a part of "HR Intergration Group" or not.
I am using this if script in workflow, but it is showing error .
answer = ifScript();
function ifScript() {
var name = current.opened_by;
var grp = "05bc6e8fdb14401025c85a35dc9619b0"; //HR integration group sys_id
if (name.isMemberOf(grp)) {
return 'yes';
}
return 'no';
}
The error is as follows:
Cannot find function isMemberOf in object.
Please help.
Solved! Go to Solution.
- Labels:
-
Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2022 11:03 PM
Use this sample script to design your script , it will work
var user = 'admin';
var group = "Hardware";
if (gs.getUser().getUserByID(user).isMemberOf(group)){
gs.log( gr.user_name + " is a member of " + group);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2022 10:30 PM
You can try
getUserByID(name).isMemberOf(group)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2022 10:39 PM
Not working.
Cannot find function getUserByID in object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2022 10:42 PM
Hi
there is no API method isMemberOf() on the sys_user table.
Maybe you are confusing this with gs.getUser().isMemberOf(). But this method only works for the logged-in user.
In your case, you have to perform a lookup in the respective table by yourself to find out whether a user is member of a group or not.
Kind regards
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2022 10:47 PM
Oh okay got it.
Will creating a script include help then?