add or remove item in glide_list (list collector) in catalog client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2023 03:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2023 03:55 AM
what's the actual requirement and what script did you start with?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2023 04:27 AM
Hi Ankur,
On change of a field I need to add or remove list option values of another field. This is glide_list and it is linked to a table

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2023 03:55 AM
Hi,
Is there a question to this question? 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2023 03:59 AM
Hi @jomonmathew
To add an item to a glide_list, you can use the addItem() method.
The addItem() method takes two parameters: the name of the glide_list and the value of the item to add.
For example, the following code adds the item "Server 1" to the glide_list named "servers":
function addServer(listName, serverName)
{
var list = g_list.get(listName);
list.addItem(serverName);
}
To remove an item from a glide_list, you can use the removeItem() method and you can also use the reset() method to clear all the items from a glide_list.
Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!
Regards,
Tushar