Hiding MRVS container based on variable value in MRVS

venkat_guthik
Tera Guru

Hi Community...
I got a requirement that, based on the inside variable value in MRVS, i need to hide the entire container,
For example, Iam having A,B,C,D variables in the MRVS container. Based on the input variable value we need to display the data in B,C and D. (here "A" is reference variable, BCD are text variables)
suppose if the value of A='empty or 'null', no need to display the other variables and also the MTVS container need to hide on the form. (entire container need to hide).
If "E" is external variable (outside the container) means, based on that we can hide the MRVS container, But this variable "A" is inside the MRVS container.
I have tried with the catalog UI polocy and catalog client script, but no luck.

Please help any one, how can i achive/implement this fucntionality please suggest.

1 ACCEPTED SOLUTION

@Ankur Bawiskar Hi ANkur, I have seen your other thread reply in the community regarding the same scenario.
https://www.servicenow.com/community/developer-forum/hide-variable-column-from-multi-row-variable-on...

DOM manipulation suggested by you. Is it good to implement this or not ?
Please let me know

View solution in original post

19 REPLIES 19

@Ankur Bawiskar Hi ANkur, I have seen your other thread reply in the community regarding the same scenario.
https://www.servicenow.com/community/developer-forum/hide-variable-column-from-multi-row-variable-on...

DOM manipulation suggested by you. Is it good to implement this or not ?
Please let me know

@venkat_guthik

please respond to below comment

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@venkat_guthik 

seems when MRVS doesn't have value it's having some empty rows

Seems logic in your BR needs to be updated

Please share the BR complete script

Your 3rd party is consuming OOB ServiceCatalog API seems and passing the variable information

Why have you written BR then? is it not setting the MRVS directly using that API?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@venkat_guthik 

what came in alert for the length?

function onLoad() {
    var rritm = JSON.parse(g_form.getValue('previous_ritm_s').toString());
    alert('mrvs value is' + rritm + ' length ' + rritm.length); // what came here
    if (rritm.length == 0) {
        g_form.setDisplay('previous_ritm_s', false);
    }
}
Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

when we are passing 2 ritms, the length coming as 2

venkat_guthik_0-1738166279106.png

when we are passing empty it is showing length=1

venkat_guthik_2-1738166431941.png

 

venkat_guthik_1-1738166404244.png