- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2018 04:17 AM
Hi,
I wrote following script inside " if " core utility inside my workflow which is basically supposed to check if the group passed inside function has any group members and if it has then check if they are active or not.
If any of the user is found active then 'yes' should be returns and workflow should proceed.
Here I have written a script which is working fine for a condition to check if group has any members or not, but it is not working while checking active status.
SCRIPT INSIDE IF:
var defaultGroupMembers = new GlideRecord('sys_user_grmember');
defaultGroupMembers.addQuery('group','ad1abd61dbceab00fce651b0cf961911');
defaultGroupMembers.query();
flag = false;
answer = ifScript();
function ifScript(){
if(defaultGroupMembers.hasNext())
{
while(defaultGroupMembers.next())
var defaultGroupMembersStatus = defaultGroupMembers.active;
if(defaultGroupMembersStatus == true)
{
flag = true;
break;
}
}
if(flag == true)
{
return 'no';
}
else
{
return 'yes';
}
}
else
{
return 'yes';
}}
__________________________________________________
Thank you,
Shivani.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2018 04:25 AM
Change this line to below,
var defaultGroupMembersStatus = defaultGroupMembers.user.active;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2018 04:28 AM
thanks it worked 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2018 04:30 AM
Hi
Please mark correct answer and close the thread.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2018 04:25 AM
Change this line to below,
var defaultGroupMembersStatus = defaultGroupMembers.user.active;