Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

UI Policy not working for variable set

crao
Kilo Contributor

Hi all,

I have created some catalog items. Since Most of them use the same variables , I have created a variable set. I want to hide a field for some of these items so I created a UI Policy on a variable set and in the catalog conditions I have mentioned that if the catalog item is A or B or C, run the UI Policy action to hide the field. The issue that I am facing is that the UI policy applies to all the catalog items using that variable set and not just to the few catalog items that I have mentioned in the condition. Any idea why this might be happening. I wanted to find out if there is a way to make this work without having to write a client script. Any suggestions?

Thanks & Regards,

Chetana

1 ACCEPTED SOLUTION

Ajai S Nair
Giga Guru

Hi Chetana,



Normally if you create a UI policy for a Variable set then it will be applicable to all Catalog items using that variable set. So in your case you have to get the catalog item name or sys_id in a variable inside the variable set and use that variable instead of 'catalog item' field in the Catalog Conditions


View solution in original post

11 REPLIES 11

Ajai S Nair
Giga Guru

Hi Chetana,



Normally if you create a UI policy for a Variable set then it will be applicable to all Catalog items using that variable set. So in your case you have to get the catalog item name or sys_id in a variable inside the variable set and use that variable instead of 'catalog item' field in the Catalog Conditions


crao
Kilo Contributor

Thanks Ajai!


What if I want the UI Policy to interact with the current Catalog Item based on variables within the Variable Set?



If you need more detail to understand what I am talking about...


I have a catalog item with a dozen check boxes. Another part of that item has 3 fields that are part of a Variable Set. The behavior I want is that depending on the values of the variable set fields, only some of the check boxes show.


Hi Simon,



In this case you can directly write a Ui policy on the catalog item with the required condition.


When you add a variable set in a catalog item it also starts behaving like a normal variable. It can be accessed from the client script and UI policy of the item.


Thanks Ajai,



disregard. that is the approach I was taking, but the variables weren't showing in the UI Policy condition builder. I've figured out what was wrong.



Thanks