I need to reflect the values of 'u_members' field in the 'sys_user_grmember' table. Please help..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2024 03:44 AM - edited 03-04-2024 04:39 AM
I am trying to reflect all the modified values of member field and reflect it in the
sys_user_grmember table. This is a catalog item for example as a manager I wanted to add a member on a specific assignment group. After adding the eid of the member and submitted the request I wanted to reflect the changes in the sys_user_group table but specific in the RLI of the assignment group which is the Group members. Existing configurations are in the script actions which I added the glide record for the group members table. Please help..
Script Actions:
var members = current.variables.u_members.toString();
var arrMembers = members.split(',');
for (var i = 0; i < arrMembers.length; i++) {
var userID = arrMembers[i].trim();
var groupMember = GlideRecord('sys_user_grmember');
groupMember.addQuery('user', userID);
groupMember.addQuery('group', current.sys_id);
groupMember.query();
if (!groupMember.next()) {
groupMember.initialize();
groupMember.user = userID;
groupMember.group = current.sys_id;
groupMember.insert();
} else {
groupMember.user = userID;
groupMember.update();
}
}
This is an example of the request item.
Where I need to reflect the changes whether to insert or update. Thanks.
5 REPLIES 5

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2024 05:20 AM