I want to get the value of Active Status field from sys_user_group table to sys_user_grmember. I have added one field(Group Active/inactive status) in sys_user_grmember table. Please help me .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 02:18 AM
I want to get the value of Active Status field from sys_user_group table to sys_user_grmember. I have added one field(Group Active/inactive status) in sys_user_grmember table.
In user table, under the groups, Group Active/Inactive Status is showing false for all the groups in which the user is present.
Now I want to get the value of Active field from sys_user_group table and set it to the sys_user_grmember table field i.e. Group Active/inactive status field. Please help
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 02:28 AM
you can do some thing like this
var group = new GlideRecord('sys_user_group');
group.addQuery('active',true);
group.setLimit(1); // test for 1 record
group.query();
while(group.next())
{
var mem = new GlideRecord('sys_user_grmember');
mem.addQuery('group',group.sys_id);
mem.query();
while(mem.next())
{
mem.u_active = group.active; // map the active field
mem.update();
}
}
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2022 05:31 AM
Your post is confusing. What is it that you want to see? Just the active field on group, shown in the groupmember list? Or in a report?
If my answer helped you in any way, please then mark it as helpful.
Mark
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2022 06:09 AM
I have added one field(Group Active/Inactive Status) in sys_user_grmember table . I want to take the value of Active field from sys_user_group to Group Active/Inactive Status field in sys_user_grmember.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2022 06:23 AM
Hi,
You can run a background script as below
> Navigate to Scripts - Background from left navigator
var grp = new GlideRecord('sys_user_group');
grp.addActiveQuery();
grp.query();
while(grp.next())
{
var mem = new GlideRecord('sys_user_grmember');
mem.addQuery('group',grp.sys_id);
mem.query();
while(mem.next())
{
mem.u_active = grp.active;
mem.update();
}
}
Mark as correct and helpful if it solved your query.
Regards,
Sumanth