Catalog Item

yoli1
Tera Contributor
 
4 REPLIES 4

Tamara11
Mega Sage

Would a reference qualifier work?

javascript: "country=" + current.variables.your_country_variable_name;

  Something like that?

Here's some more information on Reference Qualifiers because they explain it better than I can: https://docs.servicenow.com/en-US/bundle/vancouver-platform-administration/page/script/server-script...

yoli1
Tera Contributor

@Tamara11 i mean i want the field location to be visible else hide it 

if country = Thailand in Thailand we don't have no locations = hide location field 

if country = US in US we have locations = show location field 

Ah!  I see.

You could achieve that with either a Catalog UI Policy or Catalog Client Script.  I think a Catalog UI Policy  will probably require a little bit of scripting, but see if you can make the conditions work first.

 

Are you familiar with those? 

https://docs.servicenow.com/bundle/utah-platform-administration/page/administer/form-administration/...

Ashwini Jadhao
Giga Guru

Hi @yoli1 ,

 

Are you using cmn_location table for Country and Location fields?

 

You have to write onChange client script on Country field.

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    var caller = g_form.getReference('country', setlocation);

    function setlocation(caller) {
        if (caller.location== '') { //this location is from reference table. Add location field name from reference table
            g_form.setMandatory('location'false);
            g_form.setDisplay('location'false);
        } else {
            g_form.setDisplay('location'true);
        }
    }

}

 

Change field names accordingly.

 

Please mark my answer correct and helpful if it works for you.