How to hide mandatory fields

Saridha_L1
Tera Expert

Hi Team,

I am unable to hide the mandatory field using UI Policy. Because there is a variable set ,using the same field for 5 different items. can anyone help me

Regards,

Saridha.L

1 ACCEPTED SOLUTION

Shishir Srivast
Mega Sage

As other suggested UI Policy is good option where you can select the particular catalog item and then based upon variable value changes you can to set the field behavior. You can build the condition. I think when you are selecting the Catalog item then it should not impact other catalog item if they are referring the same variable set.



find_real_file.png


if there is any issue with UI Policy then give a try with catalog client script if that helps. Simple Sample Script (change the field_name accordingly)



function onChange(control, oldValue, newValue, isLoading) {


if (isLoading || newValue == '') {


return;


}


if(newValue == 'PUT THE FIELD VALUE HERE'){


g_form.setMandatory('field_name', false);


g_form.setDisplay('field_name', false);


}


else{


g_form.setMandatory('field_name', true);


g_form.setDisplay('field_name', true);


}


}


View solution in original post

12 REPLIES 12

have your tried to give higher order number on that ui policy ?


Preetam Barai
Tera Expert

Hi Saridha,



On the UI polciy Condition please select the catalog item name. On a single catalog item for a single field only one Ui policy can work. So make sure for that same field no other UI policy is running on same catalog. Please find the below screenshot where you might select your catalog item name.



find_real_file.png


Hit like or helpful if helps.


Shishir Srivast
Mega Sage

As other suggested UI Policy is good option where you can select the particular catalog item and then based upon variable value changes you can to set the field behavior. You can build the condition. I think when you are selecting the Catalog item then it should not impact other catalog item if they are referring the same variable set.



find_real_file.png


if there is any issue with UI Policy then give a try with catalog client script if that helps. Simple Sample Script (change the field_name accordingly)



function onChange(control, oldValue, newValue, isLoading) {


if (isLoading || newValue == '') {


return;


}


if(newValue == 'PUT THE FIELD VALUE HERE'){


g_form.setMandatory('field_name', false);


g_form.setDisplay('field_name', false);


}


else{


g_form.setMandatory('field_name', true);


g_form.setDisplay('field_name', true);


}


}