Glide List update from a client script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2025 09:14 AM
Hi All.
I'm preparing a PoV and getting crazy in trying to update a Glide List via a client scritp.
Here's the context:
1. I select 2+ demands from the dmn_demand table
2. I launch an UI action that reads some info from the selected demands (specifically the companies each demand is linked to)
3. I open pm_project.do page passing the companies list sysIds comma separate in the URL to create a new project
4. in the project I defined an onLoad client script that reads the companies list (I check and it's correct)
In the script I added:
g_form.setValue('u_companies', <sysIds list>)
but the attribute is always empty.
The same works with other attribute types.
Here's my code. All works except the last setValue.
Any hint?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2025 09:41 AM
Hi @Fabio Cresta I found something related to this but it is using flow. You can check it out using the link below:
Solved: How to push new values to a list (glide_list) type... - ServiceNow Community
Mark my answer helpful if it helped you 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2025 09:49 AM
HI @Fabio Cresta ,
While you are building the URL from demand table try to encode companies before you add it to URL:
example snippet:
var companies = 'sys_id1,sys_id2,sys_id3';
var encodedCompanies = encodeURIComponent(companies); //add this to urlfor u_companies
var url = 'https://yourinstance.service-now.com/pm_project.do?u_companies=' + encodedCompanies;
Try this and let me know if this helps.
Thanks