Remove selected value from list collector based on selected value in current list collector

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2023 09:29 PM
I have a list collector that should only allow either "Dual Monitor" or "Single Monitor" to be selected, but never both. This list collector has other values that can be selected that should not be removed when removing "Dual Monitor" or "Single Monitor".
Example:
I add Dual Monitor to list collector and then add Single Monitor to list collector. Script should remove Dual Monitor and keep Single Monitor.
OR
I add Single Monitor to list collector and then add Dual Monitor to list collector. Script should remove Single Monitor and keep Dual Monitor.
In both examples, if other values are part of the list collector then they should remain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2023 10:03 PM
so both the values cannot be selected. either one should be present
you can use onChange catalog client script on that variable
If both are present then what should be done? which one to be removed?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2023 10:08 PM
Which ever value is selected first should be removed. Meaning, if I add "Dual Monitor" first and then add "Single Monitor" afterwards. "Dual Monitor" should be removed since it was added first.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2023 10:10 PM
then what script did you start with and where are you stuck?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 01:09 AM
if you manipulate and remove the value and again set the variable
the onChange client script will run again
So it will go in loop again since you are setting the value using g_form.setValue()
what will happen if the user doesn't select either -> this is fine ?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader