How to store record producer Muti row variables set in custom table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2020 09:43 PM
Hi Team,
I am using multi row variable set in record producer, we are able to insert the data from Catalog item but we are not able see that data once record generated in the portal.
Please help me to understand how to store record producer multi row variable set in custom table.
Appreciate your response.
Thanks & Regards
Harish
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2020 09:47 PM
you custom table is different from the table which you selected on your record producer ?
adding sample code:
var mrvs = JSON.parse(producer.<multi row variable set internal name>);
var rowCount = mrvs.length;
for (var i = 0; i < rowCount; i++) {
var gr = new GlideRecord('Custom Table');
gr.initialize();
gr.setValue('u_account', row.<multi row column>);
gr.insert();
}
Note: you will use it on your record producer script field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2020 10:42 PM
Hi Harish,
You can either create records in custom table once target record is created or you can use record producer script
please refer sample script below which you can use in record producer script
Note: Ensure you use proper
1) MRVS variable name
2) Table columns
3) Table name
4) MRVS individual variable names such as ticket number, ticket description etc
var variableValue = producer.<MRVSvariableName>;
var parser = JSON.parse(variableValue);
var gr = new GlideRecord('table_name');
for(var i=0;i<parser.length;i++){
gr.initialize();
gr.field1 = parser[i].ticket_number;
gr.field2 = parser[i].ticket_description;
gr.field3 = parser[i].ticket_working_time;
gr.field4 = parser[i].ticket_number;
gr.insert();
}
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2020 11:55 PM
Hi Ankur,
Thank you for response..
regarding table columns do i need to create a columns in custom table which i used in record producer.
if yes, which type of variable i need to create in table.
Thanks & Regards
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2020 12:06 AM
Hi Harish,
Yes that was my assumption. You need to have columns in custom table to store the data if you wish each variable should be mapped to individual columns.
Ensure the variable type from MRVS matches the field type in custom table
Example:
If variable type of Ticket Number in MRVS is of type reference to change_request then field should also be reference type referring to change_request table
In this manner no need to extra efforts while parsing the MRVS value
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader