why UI policy is not working on variable sets?

jennyjenny
Kilo Contributor

Hi All,

I have created one variable set having 9 variables.

I want to display this variable set based on the condition.I have used UI Ploicy for this.But when form loads this variable set is displaying.

may I know how to make this work.

 

Thanks,

Jenny

1 ACCEPTED SOLUTION

Pankaj Bisht1
Giga Guru

The best practice is NOT to make any variable Mandatory and  Visible . Do that using the UI policy only.

This way there will be no clash with the conditions and states of the variable. 

 

In the UI policy use the Variable Set Name to apply action to it . That way it will be easier to work and keep a track . Make sure you tick "Reverse if False"

 

Thank you,

Pankaj Bisht

View solution in original post

5 REPLIES 5

Rajesh Mushke
Mega Sage
Mega Sage

Hey  Jennyjenny,

 

Usually variable set will hide till before Jakarta, when i worked on upgrade contacted service now for the similar issue and they said it is loop hole till Istanbul and now it is fixed. i didn't  remember the service now fixed problem number, but i remember the  issue and Solution.

 

Issue: 

If you have any mandatory variable under the variable set based other conditions in this case variable set will not hide.

 

Workaround/Solution:

Hide cascaded variables

You can hide the duplicated variables on the Choose Options screens to keep your screen clean.

When cascading variables, you can hide the duplicated variables on the Choose Options screens, making these screens simpler.

To hide duplicate variables on all screens after the initial Describe Needs screen in the Service Catalog Platform UI, run an onLoad catalog client script.

Example:

function onLoad(){
  var item = $("current_item");
  var guide = $("sysparm_guide");

  if (item == null && guide == null )
		return;

  if(item != null && guide != null && item.value == guide.value)
    return;
  g_form.setDisplay('YOUR_VARIABLE_NAME',false);}

To hide duplicate variables on all screens after the initial Describe Needs screen in Service Portal, use the isOrderGuide() API.

Example:

if(g_service_catalog.isOrderGuide()) 
  g_form.setDisplay(‘variable_name’, false);

Refer:

Cascade an order guide variable



Let me know if it not works for you.

Thanks,
Rajashekhar Mushke
Community Leader


Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke