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 .

shivashish
Tera Contributor

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

5 REPLIES 5

Harish KM
Kilo Patron
Kilo Patron

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();
}
}

Regards
Harish

Mark Manders
Mega Patron

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

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.

SumanthDosapati
Mega Sage
Mega Sage

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