create an ui policy based on a multirow variable option

mipalm
Tera Guru

Hi,
I have a form for onboarding multiple users, this form contains a multirow variable set with the user's data and a variable 'user attachment'.
I also have additional attachment variables outside of the multirow that should only appear when a certain option of 'user attachment ' is selected. That way, the variable referring to each user only appears when said user is selected.
However, when trying to create a UI Policy, I can't reach the variables inside the multirow. How could I fix this issue?

Thanks,
Miguel Santos Palmeira

1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

Hi Miguel,

You could try a scripted UI Policy, but you'll probably have to use a Catalog Client Script instead.  If the MRVS is pre-populated by the time this variable should be shown/hidden, then use an onLoad script that applies to the Catalog Item, not the MRVS.  Get the value of the mrvs, parse it, then loop through to check for the value.  Something like this:

var mrvs = JSON.parse(g_form.getValue('mrvs_internal_name')); //use your mrvs internal name
for (var i=0; i<mrvs.length; i++) {
    if (mrvs[i].variable_name == 'value') { //use your mrvs variable name and the desired value
        g_form.setDisplay('attachment_var', true);
        break;  //stop evaluating the MRVS
    }
    g_form.setDisplay('attachment_var', false); //hide the variable if none of the MRVS variable values match
}

If you want this to happen as the user is adding, then possibly editing and/or deleting rows of the MRVS, that's a bit trickier as there's not a good way to detect when the MRVS value changes from the parent form.