append multiple string fields and copy the value in a glide list field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2021 04:50 AM
Hi,
i have six string fields in a custom table , all have different group names for each record.And i have field of glide list type. I want to add all the group names in the glide list field. The glide list field is referring the custom group table.(u_sec_grp).
The six string fields and glid list type field is on another custom table(u_div). I want to append all the groups in glide list for each record.
How will i achieve that?
PLease help!
Thanks
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2021 05:52 AM
sorry,let me be clear now with the requirement.
I have five string fields that have some values in it. I want to get all the values and append all the values and store all of them comma separated in the glide list type. All the fields are in same u_div table.
For example:
field1=abc;
field2=abcd;
field3=aaa;
field4=zxc;
field5=yuy;
glide list field should have all the values.
how will i store all the values in glide list? i have to update glide list field for all the records through fix script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2021 06:25 AM
Hi,
you cannot set the names directly in glide list as it should hold sys_ids
I assume abc is the name of group in "u_sec_group" stored in u_name field
So I have already shared script for the same above
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2021 09:04 AM
Hi,
i am getting in logs "u_name IN null" for
rec.addQuery('u_name', 'IN', joinValues);
is it because that in joinValues we have all the grp names combined and they all will have different sysid and joinValues in this query will be searching for combined.
We need to fetch each grp name sysid for every six fields and then append all in glide list field.
How to achieve that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2021 07:46 PM
Also,i am getting null in logs for
arr.push(rec.getValue('sys_id'));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2021 08:34 PM
Hi,
those 6 fields are having group names or sys_ids of the record from u_sec_group table?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader