- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2022 03:14 AM
Hi. Im kinda lost in here when it comes to MRVS. but i know this is only a simple task but i cant solve the problem. The thing is i have 2 MRVS table inside my catalog which holds my values for permanent and temporary tables. but i cannot get my values from my first MRVS table and my code is not working as of the moment.
basically upon submission my first MRVS table with values will transfer it to my second MRVS table its like a copy from my first from what user filled up after submitting. then in the RITM side the first MRVS table values should be cleared and transfered the value to my second MRVS.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2022 04:09 AM
Hi,
update as this
var jsonString = current.variables.all_star_list; // temp mrvs (no read permission)
var arr = [];
var j = JSON.parse(jsonString);
for (var i=0; i<j.length; i++) {
arr.push({"vs_domain2" : j[i].vs_domain, "vs_release_comp_status2" : j[i].vs_release_comp_status, "vs_date_issued2" : j[i].vs_date_issued, "start_d2" : j[i].start_d, "end_d2" : j[i].end_d}); // creation of mrvs object
}
current.variables.all_star_list2 = JSON.stringify(arr);
current.variables.all_star_list = '';
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
‎04-04-2022 03:43 AM
Hi,
then this approach would work
1) ensure all the variables in both the mrvs1 and mrvs 2 are having same name so that you need not have complex script
2) then use workflow run script to copy and empty
current.variables.all_star_list2 = current.variables.all_star_list;
current.variables.all_star_list = '';
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
‎04-04-2022 03:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2022 03:54 AM
Hi,
can you share the script here?
in the script you shared you are using same variable name which is preset in both the mrvs i.e while getting the value and while setting the json key
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
‎04-04-2022 03:58 AM
here is my script.
var j = current.variables.all_star_list; // temp mrvs (no read permission)
var k = current.variables.all_star_list2;
var arr = [];
var arr2 =[];
for (var i=0; i<j.getRowCount(); i++) {
arr.push({"vs_domain" : j[i].vs_domain, "vs_release_comp_status" : j[i].vs_release_comp_status, "vs_date_issued" : j[i].vs_date_issued, "start_d" : j[i].start_d, "end_d" : j[i].end_d}); // creation of mrvs object
current.variables.all_star_list2 = current.variables.all_star_list;
gs.info('KACC4star2 '+current.variables.all_star_list2);
}
JSON.stringify(arr);
gs.info('KACC '+JSON.stringify(arr));
j.update();
then my second MRVS names are the ff:
start_d2
end_d2
vs_date_issued2
vs_release_comp_status2
vs_domain2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2022 04:09 AM
Hi,
update as this
var jsonString = current.variables.all_star_list; // temp mrvs (no read permission)
var arr = [];
var j = JSON.parse(jsonString);
for (var i=0; i<j.length; i++) {
arr.push({"vs_domain2" : j[i].vs_domain, "vs_release_comp_status2" : j[i].vs_release_comp_status, "vs_date_issued2" : j[i].vs_date_issued, "start_d2" : j[i].start_d, "end_d2" : j[i].end_d}); // creation of mrvs object
}
current.variables.all_star_list2 = JSON.stringify(arr);
current.variables.all_star_list = '';
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader