- 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-30-2020 07:46 AM
It is not working 😞
I have a the MRVS when i get the value i am getting in JSON object

- 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-30-2020 07:47 AM
It is not working 😞

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2020 08:30 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2020 07:29 AM
Hi there,
To get the label of a variable within your variable set, you could use something like:
g_form.getLabelOf('variable_name')
(= tested, works)
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