I am struggling in MRVS

Taaha M
Tera Contributor

I have a requirement where I have to check for date/time of fields on MRVS from the form in catalog.
I have in total four date fields, 2 date fields in form level, and two date fields on MRVS, now my requirement is to validate the date fields in MRVS is in between the dates entered on form.
I am struggling to access the MRVS values on FORM level

2 REPLIES 2

Brad Bowman
Kilo Patron
Kilo Patron

In a client script that applies to the Catalog Item, not the MRVS, you can access the entire MRVS value using

g_form.getValue('mrvs_internal_name');

This will give you a JSON formatted string containing each variable name and value for each row.  You can loop through these values like this:

var mrvs = g_form.getValue('mrvs_internal_name');
var obj = JSON.parse(mrvs);
for (var i = 0; i < obj.length; i++) {
if (obj[i].v_date1 != g_form.getValue('v_date2')) {
 ....
}

Replacing your MRVS internal name, the name of the MRVS variable (v_date1 in this example) and the name of the Catalog Item variable (v_date2 in this example).

Hemanth M1
Giga Sage
Giga Sage

Hi @Taaha M ,

 

Have you tried this : https://www.servicenow.com/community/service-management-forum/how-to-access-multi-row-variable-set-i... 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025