how to map the variables values from a MULTI ROW VARIABLE SET variables to a custom table .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2022 01:25 AM
Created a multi row variable set in portal:
these are getting to a RITM in my requested items . from there how to map MULTI ROW VARIABLE SET variables to a custom table
how to map the variables values from a MULTI ROW VARIABLE SET variables to a custom table .
i am able to map the variables values from a single row variable set to a custom table using a business rule to run run on set_req_item table :
var cret = new GlideRecord('u_police_fir');
cret.initialize();
cret.fir_type = current.variables.case_no;
cret.insert();
HOW TO DO THE SAME FOR MULTI ROW VARIABLE SET:
when i click on request in service portal
Row 1=>date and location to be mapped in a ticket =>1001
Row 2=>date and location to be mapped in a ticket =>1002
Row 3=>date and location to be mapped in a ticket =>1003
For every row an individual ticket should be created
In ticket 1001 contains u_date field and u_location field
There Row 1=>date and location to be mapped in a ticket
In ticket 1002 contains u_date field and u_location field
Row 2=>date and location to be mapped in a ticket =>1002
In ticket 1003 contains u_date field and u_location field
There Row 3=>date and location to be mapped in a ticket
- Labels:
-
Script Debugger
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2022 01:28 AM
Hi,
you can use after insert BR on sc_req_item table
Condition: current.cat_item.name == 'Your Item Name Here'
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var variableValue = current.variables.<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();
}
})(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
‎02-10-2022 11:57 PM
can you send me documentation regarding this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2022 08:16 PM
Hi,
check this
Multi Row Variable set ServiceNow MRVS - Creating - Scripting - Example - Limits
If my response helped please mark it correct and close the thread so that it benefits future readers.
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-22-2023 05:10 AM
Link is not working