- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2020 05:46 AM
Hi,
I have a MRVS when i called that i get the variable values in JSON format but i get the backend variable name not Question
How to get the question and instead of variable name
in the catalog client script if i try using
alert(g_form.getValue('mrvs_name'));
In server side
gs.info(current.variables.mrvs_name); //from workflow
I get the same output in JSON format
[ { "user" : "b326ee822f1f8890209857892799b6b3", "test2" : "asdf", "test" : "asfd" } ] |
Can anyone please help me how to display the questions ?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2020 08:23 AM
If hardcoding is OK, following script will replace the name with the question. Pass strMrvs to script include.
var columnNames = { // names/question pair of columns in mrvs
'column1': 'Column 1',
'column2': 'Column 2'
};
var mrvsObj = JSON.parse(g_form.getValue('mrvs'));
for (var i = 0; i < mrvsObj.length; i++) {
for (var key in columnNames) {
mrvsObj[i][columnNames[key]] = mrvsObj[i][key];
delete mrvsObj[i][key];
}
}
var strMrvs = JSON.stringify(mrvsObj);
alert(strMrvs);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2020 07:39 AM
The problem is getting the label name of variables in mrvs from a script on the form.
g_form.getLabelOf() will only get the label of the mrvs and not the labels of variables in mrvs.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2020 07:43 AM
I did try it myself, and it gives me the label of the variable. So not sure why you are mentioning otherwise.
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
09-24-2020 07:48 AM
Also see this article which I wrote a while back. Is on Variables, though same principle works for MRVS.
I would advise on the variable value, to get the display value.
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
10-04-2020 10:09 PM
Hi there,
Did this solve your question? Or do we need to follow-up on this?
Please mark this answer as correct if it solves your question. This will help others who are looking for a similar solution. Also marking this answer as correct takes the post of the unsolved list.
Thanks.
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