- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2018 03:18 PM
Hello,
I am still very new to using the Multi-row variable set and am having some difficulty displaying the captured data to a record. Essentially I want to use the Multi-row variable set to create a Case (or any record) through the record producer and then display the content entered in the multi-row variable set into the description field (or any other text field) of that record.
Is it possible to access the Mutli-row variable set data and loop through it row by row?
Any help is much appreciated.
Thanks,
Abdul
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2019 05:55 AM
Hi Abdul,
I was able to get this working using this script in the script field on the Record Producer:
var varName = JSON.parse(producer.mrvs_name);
var description = '';
for(var i=0;i<varName.length;i++){
description += "\n Variable1: " + varName[i].variable1 + "\n Variable2: " + varName[i].variable2 + "\n Variable3: " + varName[i].variable3 + "\n";
}
current.case_field = description;
Hope this helps!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2018 05:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2018 09:21 AM
So how would one go about accessing that and displaying certain information into the description field? I guess I am not sure how to go about this through coding it from the record producers script field.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2018 12:44 PM
It's an JSON.stringified array of objects.
So say your multirow variable set had the following variables;
Firstname, Lastname, Email
You're value of current.variables.people could be something like;
[{\"firstname\":\"Jace\",\"lastname\":\"Benson\",\"email\":\"jace@example.com\"},{\"firstname\":\"Abdul\",\"lastname\":\"Aaron\",\"email\":\"abdul@example.com\"},{\"firstname\":\"Brandon\",\"lastname\":\"Brennan\",\"email\":\"brandon@example.com\"},{\"firstname\":\"Charlie\",\"lastname\":\"Carpenter\",\"email\":\"charlie@example.com\"}]
However if you just do JSON.parse(current.variables.people) you'll get this;
[
{
"firstname": "Jace",
"lastname": "Benson",
"email":"jace@example.com"
},
{
"firstname": "Abdul",
"lastname": "Aaron",
"email":"abdul@example.com"
},
{
"firstname": "Brandon",
"lastname": "Brennan",
"email":"brandon@example.com"
},
{
"firstname": "Charlie",
"lastname": "Carpenter",
"email":"charlie@example.com"
},
]
Once you have that you can do a forEach, map, or for loop to go over it;
// the below is for testing in the browsers console
var current = {
variables: {
people: "[{\"firstname\":\"Jace\",\"lastname\":\"Benson\",\"email\":\"jace@example.com\"},{\"firstname\":\"Abdul\",\"lastname\":\"Aaron\",\"email\":\"abdul@example.com\"},{\"firstname\":\"Brandon\",\"lastname\":\"Brennan\",\"email\":\"brandon@example.com\"},{\"firstname\":\"Charlie\",\"lastname\":\"Carpenter\",\"email\":\"charlie@example.com\"}]"
}
}
// the above is for testing in the browsers console
// you're current.variables.multirowvariablename will have similiar data
var people = JSON.parse(current.variables.people);// this is now the nice array
for(var x = 0;x<people.length;x++){
var message = "Person at position " + x + " is ";
message += people[x].firstname + " " + people[x].lastname;
console.log(message);
}
/**
Output is;
Person at position 0 is Jace Benson debugger eval code:13:3
Person at position 1 is Abdul Aaron debugger eval code:13:3
Person at position 2 is Brandon Brennan debugger eval code:13:3
Person at position 3 is Charlie Carpenter
**/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2018 09:12 AM
Thanks jace, I have yet to implement this but I will give it a try soon and let you know how it goes. I appreciate the help