How to hide variables on catalog task

DevtoSME
Giga Guru

I need to hide the variables off a catalog task if a hardware is requested that doesn't need the accessories. would this be under a catalog UI action or policy and how do I add all options. it appears there's only the option to hide all of them options instead of just one at a time.

 

 

for example. A phone is selected and on the catalog task it will shows

 

hardware: phone 

accessories field:  case, charger etc.

 

I need to hide the accessory field because they don't need the extras. 

1 ACCEPTED SOLUTION

Pushkar-Snow
Mega Guru

Hi @DevtoSME ,

 

If my understanding is correct Hardware and Accessories are the fields available on the catalog item form. Now if user select Phone in Hardware drop down you want to hide accessories field.

 

You can use UI policy to hide the Accessories variable

In condition you can check the hardware selected value is phone then in policy action you can hide the variable you want. Please find below image for reference.

PushkarSnow_0-1676041454920.png

 

 

If I am able to help you with your question, Please click the Thumb Icon and mark as Correct. 

 

Regards,

Pushkar

View solution in original post

4 REPLIES 4

Voona Rohila
Kilo Patron
Kilo Patron

Hi @DevtoSME 

You can write catalog ui policy on the item with condition as hardware || is || phone and also make sure you check applies on catalog task checkbox.

In ui policy action make accessories variable display to false.


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

Best way would be to use catalog ui policy. No code and most optimized to control field behavior.

 

-Anurag

Pushkar-Snow
Mega Guru

Hi @DevtoSME ,

 

If my understanding is correct Hardware and Accessories are the fields available on the catalog item form. Now if user select Phone in Hardware drop down you want to hide accessories field.

 

You can use UI policy to hide the Accessories variable

In condition you can check the hardware selected value is phone then in policy action you can hide the variable you want. Please find below image for reference.

PushkarSnow_0-1676041454920.png

 

 

If I am able to help you with your question, Please click the Thumb Icon and mark as Correct. 

 

Regards,

Pushkar

Shivam_Tripathi
Mega Guru

Hi, @DevtoSME ,Please refer this video,
https://youtu.be/BgwB3k8qIMg

Thanks 
please Mark my answer as helpful and accept it as solution.

Catalog UI policies are used to control the behavior of the fields displayed in catalog item form. It executes on the client side. However we can write script in catalog UI policies, but it provide us the flexibility that without writing script we can make fields or Variables ready only ...