Fix script to add 3 user in a field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2025 05:58 PM
Need a fix script to add 3 users in Co-managers field in a group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2025 11:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2025 11:18 PM
field "u_co_managers" is list type referring to sys_user table?
then it should work fine
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2025 11:31 PM - edited ‎04-27-2025 11:32 PM
Image for reference of Co-managers field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2025 11:35 PM
you can do this without scripting as per approach shared by @Robert H
Your script is correct. you can add logs and debug it further. Hope the sysIds are for active users only
Your script will update only 1 record as you are using IF
Update it with while
var gr = new GlideRecord('sys_user_group');
gr.addEncodedQuery('nameINCFM.CS.US.Bank-CM,CFM.CS.US.CGS,CFM.CS.US.CMT,CFM.CS.US.CNR,CFM.CS.US.ComsMedia,CFM.CS.US.Energy,CFM.CS.US.FS,CFM.CS.US.Health,CFM.CS.US.HighTech,CFM.CS.US.HPS,CFM.CS.US.Industrial,CFM.CS.US.Insurance,CFM.CS.US.LFS,CFM.CS.US.PRD,CFM.CS.US.PublicSvcs,CFM.CS.US.RES,CFM.CS.US.SoftPlat,CFM.CS.US.Utilities,CGFBA_Pre-contract');
gr.setLimit(19);
gr.query();
while(gr.next()){
gr.manager = '92882e560f424a0035fde478b1050e44';
gr.u_co_managers = 'ccd323ce1b3899540cf8edf3604bcbaa,5ffea29e0f424a0035fde478b1050ef0,342d08871392d200daed36666144b06a';
gr.update();
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2025 11:19 PM
Hello @Deo Christian V ,
Please use a Data Management Job to get this done in 5 minutes without scripting.
Regards,
Robert