Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Hide uncheck checkboxes inside a multi row variable set

test3445
Tera Contributor

Hello , 

 

I have a multi row variable set that has check boxes that represent canada provinces, but when only once province is selected the unselected ones show as false. Is there a script to use to hide the false values in the portal and in the back end as well?  

1 REPLY 1

palanikumar
Giga Sage
Giga Sage

Hi,

Multi row variable set is accessible as JSON string. You can create onchange catalog client script and update the field. Refer the sample code

 

    var mrvs = JSON.parse(g_form.getValue('mrvs_variable_set')); 
    // Replace mrvs_variable_set with actual variable set name

    for (var i = 0; i < mrvs.length; i++) {
        mrvs[i].hide=false; // replace hide with actual variable
    }

    g_form.getValue('mrvs_variable_set',mrvs);
    // Replace mrvs_variable_set with actual variable set name

Even in backend you multi row variable set is store as JSON. You can follow similar script to update the mrvs_variable_set

Thank you,
Palani