We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Sending Multirow variable set data (of record producer) through REST API

SMayuri
Tera Contributor

I want to set a response body through Scripted rest API which has the following format:

var myJSONData = {

"result" : {

"requests" : [

{

"Request" : "ABC123",

"Employee" : []

}

]

}

};

And i want to Assign the multi row variable set details to the variable Employee in above response body.

Could anyone please help how to achieve.

 

i tried to assign the mrvs details to result['EmpDetails'] in below method,

result['EmpDetails'] = mrvs;

But the above method , returns the variable as empty array in response body, whereas in loggers i am able to view correct data getting logged.

Thanks in Advance!!!

 

1 REPLY 1

JenniferRah
Mega Sage

You will probably have to parse the JSON and loop through the values and add each row to the MRVS individually.