Dynamically remove reference qualifier onChange script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks 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
3 weeks 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 || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hope you are doing good.
Did my reply answer your question?
💡 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 || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks 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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
- Field A → True/False (Checkbox)
- Field B → Reference variable
- Requirement:
When Field A changes, remove the reference qualifier on Field B.
Create an onChange Catalog Client Script
- Type: onChange
- Variable name: field_a
- UI Type: All
- Applies to: Catalog Item

