Retrieve Multirow variable set values from a closed RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2023 06:08 AM
Hi All,
I have built a new table(Service Desk Case) which is extended from task table and have created a record producer on it.
So, on the record producer, there is a field called closed cases which shows only closed cases in a drop-down, on selection of a request, the form fields needs to be filled with the closed Case variable values. I'm able to retrieve all the variable values and populate it on the form level, but there is a MVRS as well, how do I retrieve the values of a MVRS and set the form level field with the same values, Please share any ideas on this. Below is the script I'm using to retrieve the variable values and populate it on the form level.
Script Include:
testing: function() {
var ritmnum = this.getParameter('sysparm_company');
var gr = new GlideRecord('sd_case');
gr.addQuery('number', ritmnum);
gr.query();
while (gr.next()) {
var gbsobj = {};
gbsobj.saptype = gr.variables.sap_type.getDisplayValue();
gbsobj.cur = gr.variables.currency.toString();
return (global.JSON.stringify(gbsobj));
} },
type: 'testvariablesg'
});
Client Script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('testvariablesg');
ga.addParam('sysparm_name', 'testing');
var com = g_form.getDisplayValue('latest_ritm');
//alert(com);
ga.addParam('sysparm_company', com);
ga.getXML(callBackFunction);
function callBackFunction(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if (answer); {
answer = JSON.parse(answer);
g_form.setValue('currency', answer.cur);
g_form.setValue('sap_cost_type', answer.sapcosty);
}}}
The above is working fine to retreive the variable values and populate it on the form level, but how do I retrieve the MVRS values. Please share any ideas on this.
Thank you in Advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2023 09:07 AM
Hi @Nagashree5 ,
refer below article to get the mrvs values.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0743684
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2023 09:25 AM
Hi there,
Maybe this helps:
- 2021-05-20 - Article - Creating records or a summary from Multi-Row Variable Set (2)
Kind regards,
Mark
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
04-12-2023 12:51 AM
Hi @Nagashree5 ,
If my response helps you to resolve the issue close the question by Accepting solution and hit thumb icon. From Correct answers others will get benefited in future.
Or reply if you have any issues.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 07:58 AM
I know this is an old post, but I recently came across it looking for a solution to this. I never found it on here, but I was able to get it working and so I wanted to share my solution.