Populate a list field from a client script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2022 01:25 PM
Hello all,
From a client script of a UI Page I need to put the sys id of the users that I got in the modal into a list field. I'm getting the values, as shown in the screenshoot below. But when trying to put the values inside the list field, it remains empty.
var notes = gel('notes').value;
var user = gel('users').value;
g_form.setValue('field1', user); // remains empty
g_form.setValue('field2', notes);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2022 02:40 PM
List needs , separated sys_id values.
You will need to push array values like below
https://community.servicenow.com/community?id=community_question&sys_id=483370c4db1c3b04feb1a851ca9619a4
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2022 10:22 PM
But wouldn't I be able to do this directly in the client script?
Because I need to put this value in a list field on the form. In the case of field2, it worked to put it using g_from.setValue()