Making 3rd variable hidden on selecting the 1st and 2nd variable

phr
Tera Contributor

Hi All,

 

I have a requirement where  by selecting BPML 1 and BPML 2, BPML3 contains data then BPML 3 should become mandatory.
If by selecting BPML 1 and BPML, BPML3 contains no data, then BPML3 should not be visible and not mandatory

How to achieve this with UI policy.

In my instance

1)BPML1 variable is of the type select box

2)BPML2 variable is of the type Lookup select box

3)BPML3 variable is of the type  Lookup select box

 

phr_0-1720706034471.png

Case 1 : For the below image the variable BPML3 should be visible and should be mandatory as of now its visible .

phr_1-1720706124305.png

Case 2: For the below image the variable BPML3 Should be hidden as it doesn't contain data within it.

phr_2-1720706200184.png

How to achieve this

3 REPLIES 3

SAI VENKATESH
Tera Sage
Tera Sage

Hi @phr 

 

You can follow the below procedure:

For this scenario:

Case 1 : For the below image the variable BPML3 should be visible and should be mandatory as of now its visible .

 

Create a UI Policy:

Set the Conditions to check if BPML1 and BPML2 are selected (non-empty).

and in UI Policy Actions:

make BPML3 as mandatory true and visible True.

 

To check whether BPML3 contains data or not.

You can use Run script  and add the following code: in Execute IF true

function onCondition() {
    var bpml3 = g_form.getValue('bpml3'); //change the field name 

    if (bpml3) {
        g_form.setMandatory('bpml3', true);
        g_form.setDisplay('bpml3', true);
    } else {
        g_form.setMandatory('bpml3', false);
        g_form.setDisplay('bpml3', false);
    }
}

 

Thanks and Regards

Sai Venkatesh

 

 

 

 

 

 

 

Hi @SAI VENKATESH ,

 

I tried to make use of the Ui policy, but seems like the backend variable name i am not able to select.

 

Deepak Shaerma
Kilo Sage

Hi @phr 

if you are using catalog then, create a catalog ui policy and select applies to catalog item, select your catalog item AND in catalog conditions select,, BPML1 is not empty, BPML2 is not empty , BPML3 is empty -- then mark BPML 3 to mandatory false and visible true