- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2021 05:45 AM
How to create multi row variable set in the case form. It has to be with 3 columns and n number of rows on addition.
Could anyone please suggest how it can be created in case UI .
Solved! Go to Solution.
- Labels:
-
HR Service Delivery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2021 07:25 AM
You can use this script in before insert BR of Case Table
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var mrvs = current.variables.mrvs; // your MRVS variable name here
var arr = [];
var parser = new global.JSON();
var parsedData = parser.decode(mrvs);
for(var i=0;i<parserData.length;i++){
var obj = {};
obj['Date'] = parsedData[i].date.toString(); // give here the mrvs variable name of date
obj['Incident Details'] = parsedData[i].incident_details; // give here the mrvs variable name of incident_details
arr.push(obj);
}
current.setValue('u_name_value', JSON.stringify(obj)); // your Name-Value field name here
})(current, previous);
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
03-15-2021 07:25 AM
You can use this script in before insert BR of Case Table
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var mrvs = current.variables.mrvs; // your MRVS variable name here
var arr = [];
var parser = new global.JSON();
var parsedData = parser.decode(mrvs);
for(var i=0;i<parserData.length;i++){
var obj = {};
obj['Date'] = parsedData[i].date.toString(); // give here the mrvs variable name of date
obj['Incident Details'] = parsedData[i].incident_details; // give here the mrvs variable name of incident_details
arr.push(obj);
}
current.setValue('u_name_value', JSON.stringify(obj)); // your Name-Value field name here
})(current, previous);
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
03-15-2021 10:10 PM
Thank you for marking my response as helpful.
If my response helped you please mark it correct to close the question so that it benefits future readers as well.
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
03-16-2021 02:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2021 04:53 AM
Hi,
you can add logic to add counter
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var mrvs = current.variables.mrvs; // your MRVS variable name here
var arr = [];
var parser = new global.JSON();
var parsedData = parser.decode(mrvs);
for(var i=0;i<parserData.length;i++){
var obj = {};
var dateKey = 'Date' + parseInt(i+1);
var incidentKey = 'Incident Details' + parseInt(i+1);
obj[dateKey] = parsedData[i].date.toString(); // give here the mrvs variable name of date
obj[incidentKey] = parsedData[i].incident_details; // give here the mrvs variable name of incident_details
arr.push(obj);
}
current.setValue('u_name_value', JSON.stringify(obj)); // your Name-Value field name here
})(current, previous);
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
06-14-2022 11:44 PM
can u give me the script for this?