Make a field visible w.r.t a reference field when it contains nothing but not when form is loaded.

1_DipikaD
Kilo Sage

Hi All,

I have a reference field in record producer which refers to company table and a string field also there named "other organization name" which is  to be mandatory and visible when the Organization Name field  contains no value.

But now the field is when form is loaded but I want the field to be visible when value changes . Also the company table contains empty records that means if I select empty record the Other Company field will not be visible. How to configure it when reference field value contains no value then the string value should visible but not when form is loaded.

 

Thank You

7 REPLIES 7

debendudas
Mega Sage

Hi @1_DipikaD ,

Please follow the below:

  1. Create a Catalog UI Policy and provide this condition: "Company" - is empty
  2. From the Related list of the Catalog UI Policy create a Catalog UI Policy Action as below:
    Variable name: "Other Company Name"
    Mandatory: True
    Visible: True
  3. Save the UI Policy Action and test if it's working perfectly or not.

Please check the name of the variables.

 

Also, it is recommended to use a reference qualifier on the Company variable to hide all the company records which has empty name.

 

If this solution helps you then, mark it as accepted solution ā€Œā€Œāœ”ļø and give thumbs up šŸ‘

PritamG
Mega Guru
(function executeRule(current, gForm, gSNC) {
    var orgName = gForm.getValue('organization_name'); 

    if (!orgName) {
        gForm.setMandatory('other_organization_name', true);
        gForm.setDisplay('other_organization_name', true);
    } else {
        gForm.setMandatory('other_organization_name', false);
        gForm.setDisplay('other_organization_name', false);
    }
})(current, gForm, gSNC);

use this code in create new record producer and write this code in client script.

1_DipikaD
Kilo Sage

I have already tried this before then I realized the string field is visible when form is loaded as well but it should not be like that. Also if I select empty records from company table the UI policy will not work  .

I think you haven't checked the "On load" checkbox present in the Catalog UI Policy form

debendudas_0-1738650383980.png

Please check that and try again.