How to access to the values of a MultiRow Variable Set in a Business rules

Facundo Prado
Tera Expert

Hi!! I need to get the values form a MultiRow Variable Set in a business rules. Because I need to populate this values (from MRVS) into a new table.

MRVS:

FacundoPrado_3-1682536642274.png

FacundoPrado_2-1682536638986.png

 


Business Rule:

FacundoPrado_1-1682536582068.png

FacundoPrado_0-1682537826737.png

 



I need to populate those values into a new table.

New table:

FacundoPrado_4-1682536742997.png


Thanks

6 REPLIES 6

Thats because current.variables was null.  So the code ran for a record that did not have the data you were looking for.  You need to do a check beforehand.  Something like

var mrv = [];
if(current.variables.booking_details)
     mrv = JSON.parse("" + current.variables.booking_details);
else 
     return;

 

You should find a requested item that has data in the MRV you want to mess they and then use a background script in your dev instance to test it.

 

Hi I had the issue and solved it. The objects are not Json parsible , how I resolved this was I used Json stringify first.

 

var mrvs = JSON.parse(JSON.stringify(fd_data._2__get_catalog_variables.multi_row_var));

htmlTable += '<tr><td>Test</td><td>'+ mrvs[0].field_name + '</td></tr>';

 

The Field name is the  Variable name in service now UI