How do I make a certain Variable Set, Select Box Variable value visible on a specific Catalog Item?

ronro2
Tera Contributor

Hello guys!

I am trying to make a Lookup Select Box value (sys_id "79e7f9b2f5b49650f90a24bb174a1d0c") within a Variable Set visible, for a certain catalog item with sysID "680c964ac881c61c068b681d35cc5b1d". 

 

The variable set is called "vgr_function_profile_mobile" while the Lookup Select Box variable is called "functionprofile_mobile". Under "functionprofile_mobile" there is this Reference Qualifier: 
u_mobil_funktionsprofil=true^u_active=true^sys_id!=79e7f9b2f5b49650f90a24bb174a1d0c^ORDERBYu_utbud

I tried a solution by adding a Catalog Client Script on this specific catalog item, which looks like this: 

 

function onLoad() {
    var functionProfileField = g_form.getControl('functionprofile_mobile');
    if (functionProfileField) {
        var variableSet = g_form.getControl('vgr_function_profile_mobile');
        if (variableSet) {
            var currentSysId = g_form.getValue('sys_id');
            if (currentSysId) {
                g_form.addOption('functionprofile_mobile', '79e7f9b2f5b49650f90a24bb174a1d0c', 'Vårdklient Transport & städ');
            }
        }
    }
}

 


However it didn't work. The Reference Qualifier is still overriding/hiding the value which I want to show only for the specific cat item.

How would you do to make the Variable Set's Lookup Select variable value 79e7f9b2f5b49650f90a24bb174a1d0c visible for the specific catalog item? 



2 ACCEPTED SOLUTIONS

debendudas
Mega Sage
Mega Sage

Please refer the below posts:
Solved: how to show a field in a variable set for a partic... - ServiceNow Community

Variable set should be visible on one particular c... - ServiceNow Community

If this solution helps you then, mark it as accepted solution ‌‌✔️ and give thumbs up👍

View solution in original post

Brad Bowman
Kilo Patron
Kilo Patron

You cannot change the reference qualifier via script, unless you are using only Service Portal, not the native UI / service catalog view.  The common workaround is to create another variable for this Catalog Item with the desired reference qualifier, then hide the variable in the variable set for this one Catalog Item via UI Policy that applies to the Catalog Item, not the variable set.

View solution in original post

3 REPLIES 3

debendudas
Mega Sage
Mega Sage

Please refer the below posts:
Solved: how to show a field in a variable set for a partic... - ServiceNow Community

Variable set should be visible on one particular c... - ServiceNow Community

If this solution helps you then, mark it as accepted solution ‌‌✔️ and give thumbs up👍

Brad Bowman
Kilo Patron
Kilo Patron

You cannot change the reference qualifier via script, unless you are using only Service Portal, not the native UI / service catalog view.  The common workaround is to create another variable for this Catalog Item with the desired reference qualifier, then hide the variable in the variable set for this one Catalog Item via UI Policy that applies to the Catalog Item, not the variable set.

Brad Bowman
Kilo Patron
Kilo Patron

Here's an alternate approach that eliminates the need to create another variable

https://www.servicenow.com/community/now-platform-articles/yes-you-can-effectively-set-or-update-a-r...