How to retrieve multi row variable set data using Business rule

Are Kaveri
Tera Contributor

Hi ,

 

I have following requirement for outbound integration.

 

We have ABC Record producer ,

details - Multi row variable set

the below are variables under multi row variable set

Requestor, Department, Hiring Date

 

 

We need to send the Data of multi row variable set.

 

for this i have written following Business to get the data for multi row variable set but not working as expected

 try { 
 var r = new sn_ws.RESTMessageV2('my rest message');

var DetailsArray = JSON.parse(current.variables.details);
		var Arr = [];
		for (var i = 0;i<DetailsArray.length ;i++){
		 Arr.push(DetailsArray[i]['requestor','department','hiring_date']);
		}

		r.setStringParameterNoEscape('details', Arr); // not getting the data of multi row variable set
}

 

Please help me how to pull multi row variable data.

6 REPLIES 6

Go with the script I posted - there's nothing specific about my MRVS in the script.  The GlideRecord returns all of the rows of all populated MRVS variables for the current record on whatever table this is running on.  If you only want to retrieve 3 variables in the MRVS and there are more than that you can add an addQuery line.  To test the infoMessage I'm running this as a display BR.  Look at a list view of the sc_multi_row_question_answer table if it's still not clear what this is doing.

@Brad Bowman   when i tried the code it was not printing the values.

 

Hence i have went through another approach.

 

 

 try { 
 var r = new sn_ws.RESTMessageV2('my rest message');

var multiRow = current.variables.details;

gs.debug("get Row",+multiRow);

r.setStringParameterNoEscape('details', multiRow); 
}

 

 

when i checked in background script the output as below

 

x_student: print multi row[ {
  "department" : "IT",
  "hiring_date" : "09.11.2021",
  "cost_center" : "1000"
}, {
  "department" : "IT",
  "hiring_date" : "09.11.2022",
  "cost_center" : "1001"
} ]

 

 

So I want below output as Row

I have  added to print 2 records as

 

var multiRow = current.variable.details.getRow[2];

 

it was printing the 2 rows. If i need all row in the multi Row variable what should  i need to use?