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.

How to hide the field in variable set (MRV) on the basis of outside of variable set-catalog variable

jaiho_rai
Kilo Sage

Hi ,

 

I need help from you guys ,

I need to hide the variable - in the variable set on the basis of other variable within same catalog item.

 

E.g My catalog item variable - ABC

 

My catalog item variable set - variable - 123

 

now, on the basis of "ABC" , it will hide within variable set - variable  - "123"

1 ACCEPTED SOLUTION

jaiho_rai
Kilo Sage

 

I tried some alternate ways because I am not getting the options in the conditions,

So I created conditional-based 5 MRVs and hide based on UI policy > Run script.

Let's say:

1- Catalog item Variable --> Request Type - ABC >

Run script - Variable Set --> Request Value > MRV1 (will show) and other MRV2, and MRV3 will be hide 

 

2- Request Type - XYZ 

Run script - Variable Set --> Request Value > MRV2 (will show) and other MRV1, and MRV3 will be hide 

 

Catalog Ui Policy :

Condition - Request Type

Run Script -True

If Yes -

g_form.setDisplay('variable Set Name (MRV1)', true);
g_form.setDisplay('variable Set Name (MRV2)', false);
g_form.setDisplay('variable Set Name (MRV3)', false);
 
If No ,
g_form.setDisplay('variable Set Name (MRV1)', false);
g_form.setDisplay('variable Set Name (MRV2)', false);
g_form.setDisplay('variable Set Name (MRV3)', false);
 
 
and so on..

View solution in original post

6 REPLIES 6

Dr Atul G- LNG
Tera Patron
Tera Patron

You can use the catalog ui policy and with dot walk to varibale set. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

I possible could you share the piece of code?

Hi @jaiho_rai 

 

Here is minimum code

 

AGLearnNGrow_0-1710415605696.png

 

 

These are  MRVS, and now you can create tehe UI Action. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hi ,

@Dr Atul G- LNG  I didn't get those options , because fixed choice field value , I believe you have chososen the related fields options but in here there is not such option , It directly show the variable set name only.