How to add an array to List field type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2023 02:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2023 03:00 AM
do this while pushing into array
arr.push(gr.group.toString());
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2023 01:27 AM
Thank you for marking my response as helpful.
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
‎07-06-2023 03:06 AM
I'd recommend avoiding taking photos and instead just post the code directly so it's easier to see.
But from what I can read from the photo's, it looks like on your client script you have "ans = and" on line 17.
Perhaps it's supposed to be ans = ans.
Also when using while loops for GlideRecord it's a good idea to use something like toString to make sure you're not including a reference to an object. For example in the script include I'd change arr.push(gr.group) to arr.push(gr.getValue('group')). (Or gr.group.toString() works as well)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2023 03:10 AM
What you can do is use:
arr.push(gr.getValue("group")); // will give you the sys_id of the group
arr.push(gr.getDisplayValue("group")); // will give you the display value of the group that is visible on the forms
If this answers your question and solves your problem, kindly mark this answer as the solution.