- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2020 03:58 AM
Hi Team,
Can anyone please help , How to do Map to field on MRVS ,there is no direct option, is there anyway to achieve.
Regards,
Saridha.L.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2020 06:11 AM
try with below code , i have added log as well. so check the log if it does not work, and let me know the log result as well
var mrvs = JSON.parse(producer.journal_entry_line_items);
var rowCount = mrvs.length;
gs.log('Length is '+ rowCount);
for (var i = 0; i < rowCount; i++) {
var gr = new GlideRecord('x_journal_entr_journal_entry');
gr.initialize();
gr.setValue('u_account', row.u_account);
gr.setValue('u_cost_center', row.u_cost_center);
gr.insert();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2020 05:59 AM
What's exactly not working? Can you also share screenshots of your setup?
Also if you are using "x_journal_entr_journal_entry" as table, I would guess this is scoped? Is that correct? Can you then also double check your field names? For scoped u_ is not standard.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2020 06:29 AM
Just tested my code in scoped app. Works instantly.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2020 06:31 AM
Like I mentioned, do double check your MRVS internal name, Table name, Variable names, Field names (I guess your table is scoped, so are your field names u_account & u_cost_center or are these account & cost_center).
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2020 08:35 AM
So did this work for you? I provided you with a lot of questions to point you in the right direction, and then I provided sample working code.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2020 06:00 AM
can you paste the script which you have tried also let me know how are you testing it ?