How to fetch the mrvs variables.

AnandKumar1
Tera Expert

Hi Team,

In MRVS I have list collector variable. Here in each row i can able to add more then 1 ci in the list collector. And through workflow i am passing that value to api.

 

Here, I am facing challenge for adding multiple rows. For instance, for row 1 if i add 3 ci in list collector i can able to fetch it.. 

AnandKumar1_0-1695379432565.png

 

then if add another row, then 1st row 2 record and 2nd row 1record means, then the values i am not able concardinate here. Can someone assist here how to do outloop to get values.

 

below are my script 

 

var source_name;

var mvrs = JSON.parse(current.variables.u_request_details);

var mvrsLength = mvrs.length;

gs.info("Anand API - FireFlow mvrsLength 1: " + mvrsLength);

for (var i = 0; i < mvrs.length; i++) {

var sourceCMBD = mvrs[i].source_cmdb;
gs.info("Anand  API - FireFlow SourceCMBD 2: " + sourceCMBD);

var sourceName = new GlideRecord('cmdb_ci');
var query = 'sys_id=' + sourceCMBD;
sourceName.addEncodedQuery(query);
sourceName.query();
while (sourceName.next()) {
source_name = sourceName.name;
}

 

And like below i am sending the payload to api. >>>>>>>>>>>>>>

 

var r1 = new sn_ws.RESTMessageV2('ANAND API - FireFlow', 'Fireflow Traffic Change Request');

r1.setStringParameterNoEscape('source_name', source_name);

r1.setMIDServer('************');
var response1 = r1.execute();
var responseBody1 = response1.getBody();
var httpStatus1 = response1.getStatusCode();

var parsedResponse2 = JSON.parse(responseBody1);