How to hide a variable set based on a catalog item variable value?

Bidduam
Tera Guru

I have a variable set that I've added to my catalog item, but I only want it to be shown if a particular catalog item variable is set to no.

The variable set is called:

vs_address_details

It's sys_id is:

df104b8ec1a25250daa3b371506bdab9

 

The variable (that is not in the variable set) on the catalog item is a yes/no field:

u_office_pickup_yn

 

I have tried a catalog ui policy, but it won't work if I set it to catalog item and choose 'visible' and "Reverse if false" is set to true on each field in the variable set, or even just choose the variable set.

 

Also if I try it on the actual variable set, I can't choose the variable on the catalog item as a condition.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Bidduam 

another way is to explicitly show/hide the variables within the variable set based on the other variable

remember you need to make the variables non-mandatory to hide them

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

12 REPLIES 12

@Ankur Bawiskar thank you, ultimately the issue I had was as a variable set also being used elsewhere the variables are by default set to mandatory and I can't change that on the variable set.

 

So I ended up adding an onLoad catalog client script to set the fields as non mandatory on load, then I could hide them and make them visible (and mandatory) via a catalog UI policy when the right value was selected.

Nishant8
Giga Sage

Hello @Bidduam, If you just want to control the visibility of a variable set based on any other variable existing on catalog item, then your approach using UI policy should work fine.

- Apply UI policy on 'A Catalog Item'

- in the condition, select the variable of your choice and its corresponding value

- Create a new UI action policy: select the Variable set or any variable inside and set Visible as False

 

In my view, above steps should work fine. If not, can you please share your UI policy screenshot?

 

Regards,

Nishant

Tami Lewis1
Tera Contributor

I had the same problem and was able to solve it with a Catalog UI policy as follows.

I don't understand why it works by doing it 'backwards' like this, but it did. 
Our use case is around quantity. If qty is 1, show only VS 1. If qty is 2, show VS 1 and VS 2. If qty is 3, show VS 1, VS 2, and VS 3. This one is for VS 2.

TamiLewis1_0-1757345750509.png

 

TamiLewis1_1-1757345762093.png