MRVS Getting error

Venky Kshatriy2
Mega Sage

Hi team,

 

I have a two variables in MRVS (From_country & to_country)  to_country variable is changes i need to fetch the of both variables values.

 

it is possible?

 

for this thing i written below script

 

ar vk = g_form.getValue('country_names');
 
  var multiRowValues = JSON.parse(vk);

  // Perform the comparison with backend table values
 
  for (var i = 0; i < multiRowValues.length; i++) {
    var row = multiRowValues[i];
    alert(row);
 
VenkyKshatriy2_0-1721240529275.png

i am getting like this if row's are i will get 3 times of alert with  same snap(above pic)

 

if any one knows abt this help to resolve issue

 

Advance thanks team,

3 REPLIES 3

AshishKM
Kilo Patron

Hi @Venky Kshatriy2 

 

Update the code as below and test. 

 

var vk = g_form.getValue('country_names');
 
  var multiRowValues = JSON.parse(vk).toString();

  // Perform the comparison with backend table values
 
  for (var i = 0; i < multiRowValues.length; i++) {
    var row = multiRowValues[i];
    alert(row);

 

 

Your other post for same:

https://www.servicenow.com/community/itsm-forum/question-on-multi-row-variable-set/m-p/2992513#M5244... 

 

-Thanks,

AshishKM

Brad Bowman
Mega Patron

Inside the for loop use the MRVS variable names with the object and iteration

alert(multiRowValues[i].to_country);

 

good catch, i missed that part.