Clear all values of a multi-user variable of type requested_for
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I am building a catalog item that includes a multi-user variable of type 'requested_for'. The checkbox 'enable_also_request_for' is enabled for this variable. There is a a catalog client script (onChange) that clears the value of requested_for when another variable changes. Here is the script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.clearValue("requested_for");
}The current behaviour is that when 'remove_or_add_checkbox' changes value only the first row/user from requested_for is being cleared (where snowflake.reporting user appears).
The expected behaviour is that I'd like all users (including admin, data management & AWS clouddiscovery) to be cleared when 'remove_or_add_checkbox' has another value (e.g. when switching from 'add' to 'remove'). Please see the attached screenshots for reference.
Has anyone experienced this issue or knows how to clear all selected users in a multi-user variable via client script? Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
both the variables have same name and hence the issue and it's clearing only the 1st one.
the 2nd variable is list collector and give it some other name and enhance your script as this and it will clear both
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
58m ago - last edited 45m ago
Hi there,
I'll try to reproduce. Maybe its a weird thing of the requested_for variable type.
It's not what Ankur is mentioning in his reply. Since its about the requested_for variable type.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
