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

weiweizhang
ServiceNow Employee
ServiceNow Employee

Hi, try create the ui policy for each item instead of on a variable set.


crao
Kilo Contributor

Yes thanks Weiwei. I had created UI policy for individual items and that worked. I wanted to know if there is a way to achieve this without having to create multiple UI policies. I found out why my UI Policy is not working. Its because the condition will run only when the field is on the form. Below are my conditions in my UI Policy. ' Catalog item' field should be on the catalog form for the policy to work. I am unable to get this field on the form



find_real_file.png


shouvik
ServiceNow Employee
ServiceNow Employee

Chetana,



Catalog Ui Policy works only on variables. So even if you select condition fields which are not variables, these will not work for you.



Check bullet point 2 in the documentation


Service catalog UI policy



You have to define the ui policies for individual variables.



Thanks


Shouvik


PS: Hit like, Helpful or Correct depending on the impact of the response


crao
Kilo Contributor

Thanks for the document Shouvik. Correct me if I am wrong but what I understood from the document is that UI Policy for a variable will work on both catalog item and variable set as long as the variables used in select field condition are on the form