When the request type variable is selected as none in catalog form, then no options should appear.

Deeplaxmi
Tera Contributor

Hi All,

 

Problem : There is a variable named "Request type" with type as select box. It has 3 choices on catalog.

1. None

2. XYZ

3. MMN.

When I select None, then all the variables below variable "Request type" should be hidden.

When I select XYZ, then some 6 variables to be displayed below variable "Request type" .

When I select MMN, then some 6 variables to be displayed below variable "Request type" .

 

I have wriiten 3 UI policies with below conditions.

1st UI policy name : When its None.

I created condition -> <Request type || is || None> and created all policy actions which I wanted to hide. Set their visible to false.

Similarly did for the other two as well (XYZ and MMN)

The issue that happens :

1). When I click "Try it" :- When I select "none", some random variables appear (When actually it must not appear). Every time some different random variables appear

2). Second issue, when I select "XYZ", some unwanted variables appear, which I have not even created in UI policy action. To avoid their appearance , I still created them as UI policy action and made them false but still they appear

 

I also created a Client script as below for "None" but no luck

function onLoad() {
   
    if(request_type=='None'){
    g_form.setVisible('reason_replaced_by_Justification_impact'false);
    g_form.setVisible('justification_of_reason'false);
    g_form.setVisible('effective_month_s'false);
    g_form.setVisible('reason'false);
    g_form.setVisible('reason_with_checkboxes'false);
    g_form.setVisible('justification_impact'false);
    g_form.setVisible('forecast_point'false);
    g_form.setVisible('ramp'false);
    g_form.setVisible('airport_location'false);
    g_form.setVisible('list_station_id_s_assignment'false);
    g_form.setVisible('old_airport'false);
   
    g_form.setVisible('reason_stationmove'false);
    }

 

I am really struggling and stuck with this..... please suggest me, Thanks !

8 REPLIES 8

Not applicable

Hi @Deeplaxmi ,

 

Let me sum it up. "None" options will hide all variables that are included in both "XYZ" and "MMN" options, no other variables. Both XYZ and MMN options contains some common variables.

So let's make an example like this:

Option XYZ: shows ABCDEF

Option MMN: shows CDEFGH

=> We have common variables are: CDEF.

 

1. Disable the Client script, you just need to use UI Policy, it will handle the hiding job for you.

2. Create 1 UI Policy [Request type is XYZ] with UI Policy action are variable A + B.

3. Create 1 UI Policy [Request type is MMN] with UI Policy action are variable G + H.

4. Create 1 UI Policy for [Request type is one of XYZ, MMN] with UI Policy action are variable C + D + E + F.

 

* Remember to tick "Reverse if false" in all UI Policies.

 

Please try it again.

Not applicable

Hi @Deeplaxmi ,

 

Did you try my response above to see if it works? Really want to know so I can assist you to get this done.

Hi, I am working on that, Thanks !

 

Thanks a lot for the assistance

Jim Coyne
Kilo Patron

To make it simple to understand and maintain, I would create 3 UI Policies, one for each "Request type".  Start by creating the UI Policy for when the Request type is "-- None --".  Set the Short description and Catalog Conditions, make sure "Reverse if false" is NOT checked (very important) and then add all the variables (except for Request type) as Catalog UI Policy Actions with the "Visible" field set to "false" (I've only added 3 in my test).

 

JimCoyne_0-1690957182914.png

 

Make sure that policy is working when the item is first shown on screen.  The variables should not appear:

 

JimCoyne_1-1690957379874.png

 

Now go back to the UI Policy.  Change the Short description to "Show Variables when Request type is MMN", change the Catalog Conditions and then right-click the form header and select "Insert with Actions":

 

JimCoyne_2-1690957640222.png

 

This will create a new UI Policy with copies of the Catalog UI Policy Actions.  Set the "Visible" field to the appropriate value:

 

JimCoyne_3-1690957895570.png

 

Test the item again to make sure both UI Policies are working:

 

JimCoyne_5-1690957998417.png

 

Go back to the new UI Policy, change the Short description to "Show Variables when Request type is XYZ", change the Catalog Conditions and select "Insert with Actions" again.  Set the Visible field to the appropriate values and test the item once again:

 

JimCoyne_8-1690958309411.png

 

 

JimCoyne_7-1690958255857.png

 

Now the proper variables should appear when the Request type is selected.  The important part is making sure the "Reverse if false" option is NOT selected.  That means only 1 UI Policy will run to set all the variables properly.  Having them all listed in each UI Policy ensures they are shown or hidden when appropriate.  The "Reverse if false" option is tricky with a Select box variable. Having the UI Policies setup this way may seem like overkill, but they are simple to understand this way.  No need to setup "shared" UI Policies for common items and try to figure out how the variables will be set based on if the condition matches or not.