- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2022 11:40 PM
HI Team,
I have a record producer. Inside record producer i have created a multi row variable set name calle d as "item_list". Inside multi row variable set i had 6 variables.
As soon as i submit the record producer from portal, A record is creating to that table but fields are showing empty.
So how can i map those MRVS variable content inside native view table fields?
\
I had created a before Business rule to map MRVS to table fields but not working
the MRVS log is showing error like below
(function executeRule(current, previous /*null when async*/) {
var value = current.variables.items_list; // MRVS variable name here
gs.log('Inside :', value);
var parser = JSON.parse(value);
gs.log(parser);
var addtable = new GlideRecord('x_pl4_move4u_item');
for(var i=0;i<parser.length;i++){
addtable.name = parser[i].name;
addtable.move_request = parser[i].move_request;
addtable.is_fragile = parser[i].is_fragile;
addtable.category = parser[i].category;
addtable.short_description = parser[i].short_description;
addtable.volume = parser[i].volume;
addtable.insert();
}
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2022 03:24 AM
are you using correct variable name within mrvs here?
var parserList = JSON.parse(producer.items_list);
current.name = parserList[0].name;
current.move_request = parserList[0].move_request;
current.is_fragile = parserList[0].is_fragile;
current.category = parserList[0].category;
current.short_description = parserList[0].short_description;
current.volume = parserList[0].volume;
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-21-2022 02:45 AM
Hi,
then if MRVS contains 5 rows then how many records it will create on that target table?
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-21-2022 02:48 AM
for whole MRVS one record on target table .
@note my record producer is in x_pl4_move4u_item table. as soon as i submit this record producer i want a record has to be create in backend with the entered information.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2022 03:01 AM
Hi,
your record producer target table is x_pl4_move4u_item
you want to create records in same table via MRVS script x_pl4_move4u_item
Why that requirement?
In that case there would be n+1 records on the table x_pl4_move4u_item considering n rows are added to MRVS
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-21-2022 03:07 AM
Ankur,
I have created a record producer with one multi row variable set. My record producer is on "x_pl4_move4u_item" table.
Inside the multi row variable set i had 6 variables. As soon as i fill all those variables and submit. After i submit from portal , when i check that record in native view , though the record is created but fields are not populating, showing as empty.
what could be the problem?
My aim is just to create the record producer record. Thats it.
when i am not adding the script. record is creating but fields inside the table are blank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2022 03:19 AM
I assume user will add only 1 row
update record producer script as this
var parserList = JSON.parse(producer.items_list);
current.name = parserList[0].name;
current.move_request = parserList[0].move_request;
current.is_fragile = parserList[0].is_fragile;
current.category = parserList[0].category;
current.short_description = parserList[0].short_description;
current.volume = parserList[0].volume;
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader