Dynamically remove reference qualifier onChange script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
15 hours ago
Is there a way to remove a reference qualifier acting on a Service Catalog variable when a user changes the value on another variable?
Ex.
Field A (True/False)
Field B (Reference field)
if(Field A changes)
Field B (remove reference qualifier)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
15 hours ago
you can use advanced ref qualifier which depends on other variable.
using client script not possible to change reference qualifier
You are ServiceNow employee, you can check internally with the product team if you wish to.
💡 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
15 hours ago - last edited 15 hours ago
You can use an if statement as using the javascript: prefix enables that field to accept JavaScript.
If it's a bit more complex, then you can use a Script Include as well.
So use if statement , it's like:
javascript: var queryVarB; if (current.variables.variable_A = = True) { queryVarB="<encodedQuery1>"; } else { queryVarB="encodedQuery2"; } queryVarB;
