How to setup MRVS Minimum row count?

Kritika1
Tera Contributor

From the Thread :

https://www.servicenow.com/community/developer-forum/how-to-set-minimum-row-requirement-of-mrvs/m-p/...

 

Hi All,

 

I wrote the same code, but it is not working. 

Can you pelase check the issue:

function onSubmit() {
    var bulk = g_form.getValue('is_this_a_bulk_request_for_than_5_account');
    var mrvs = g_form.getValue('user_details_bulk'); //mrvs1
    var mrvs2 = g_form.getValue('user_details_remove_bulk'); //mrvs2
    var parser = JSON.parse(mrvs);
    var parser2 = JSON.parse(mrvs2);

        if(parser.legth < 2 || parser2.length < 2)
        {
        g_form.addErrorMessage('Oops, you have submitted a bulk request for 1 user.  Please either add additional users; or if your request is for 1 user, select the option of "1 account".');
        return false;
        }
}
 
It just throws the Javascript error.
5 REPLIES 5

Nick Parsons
Mega Sage

Can you please check what the error is and share that? It is available in your browser console.

Without an error we can only guess what's wrong. Potentially you haven't specified the correct MRVS names so it's trying to parse undefined and throwing an error.

Kritika1
Tera Contributor

I have already specified the correct ones. Please see the below screenshots::
Error screenshot::

Kritika1_0-1738540599846.png

 

My 2 MRVS variable set::

Kritika1_1-1738540685601.pngKritika1_2-1738540698418.png

 

Thanks.

That's just the servicenow error banner. You can view the error details by opening up your browser developer tools and going to the console tab. The error details will be in there.

It shouldn't be causing an error, so I suggest still looking at your browser console for the details of the error, but you have misspelt length as legth in your if-statement condition.