How to show/hide fields based on the other list field reference table column which is true or false

Sagar S
Tera Contributor

Hi,

 

We have requirement in which on a form there is a  list collector field called 'policy' referencing to another table. In that reference table there is a 'info required'  field which is a true/false . We need show/hide another field 'MNP info' on a form based on the reference table field 'info required'. Any help on how to achieve this.

 

Regards,

Sagar

14 REPLIES 14

Hi @Sagar S,

 

If you share the script, we may be able to help 🙂


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

var reference = g_form.getReference('u_policy', getInfo);

function getInfo(reference) {
if (reference.u_mnpi_info_required == 'true') {
g_form.setVisible('u_was_the_information_mnpi', true);
}

}

How are you going to determine which record in the list collector you want to evaluate? Or do all need to be evaluated?


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

The List collector policy field may contain one or more records, if one of the record has the "u_mnpi_info_required" column  is checked (true) then i should show the "u_was_the_information_mnpi" on the form . If none of the records in the list collector has not checked(true) the column "u_mnpi_info_required" , then i should hide the "u_was_the_information_mnpi" on the form

Sandeep Rajput
Tera Patron
Tera Patron

@Sagar S You can use an OnLoad Client script and a Server side script include to achieve this implementation. From your onLoad client script, you can call you script include method using GlideAjax and during this call you can pass the value of list collector as a parameter. On the server side, you can check if the info required field for the given record is true or not, on the basis of which you can return either true or false to your client script. In client script you can show/hide the MNP field based on the value received from the script include in the callback function.