Client script for reference qualifier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2025 10:48 PM
Hello Team, I am trying to write a code for variable in a variable set of type reference which should filter the table it is referencing and populate with two possible values using onLoad catalog client script. I tried but haven't found a solution for that can you help me to solve this thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2025 09:42 AM
@Ankur Bawiskar as I mentioned it is in a variable set if I change it will affect all the catalog's in which it was included so, I need to write a script for this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2025 08:26 PM
then you can write onChange catalog client script which Applies to your Catalog Item and your variable
Then check if user has selected either of those 2 options
If not then show an field message with error for that variable
something like this
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
g_form.hideFieldMsg('variableName');
if (newValue == 'sysId1' || newValue == 'sysId2') {
// do nothing
} else {
var message = 'Please select either of these 2 values';
g_form.clearValue('variableName');
g_form.showFieldMsg('variableName', message, 'error', true);
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-22-2025 03:49 AM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-22-2025 03:19 AM
thank great
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-22-2025 12:22 AM
Hi @charanpatnala,
The function getDynamicValueFieldRefQual returns a query. In your own function, you can use that variable set to return a default query for other record producers while filtering the referencing table for your specific record producer.