How do I read the values of variables in multi row variable set ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2019 02:07 AM
How do I read the values of variables in multi row variable set ?
I have create a multi row variable set for catalog item form in Service portal.
So that I can add multiple disk spaces just by clicking on add.
How do I read the values of those variables in workflow?
I have tried using "current.variable_pool.disk_space.getDisplayValue()" and also current.variables.disk_space.getDisplayValue().
But I am not able to read the values of variables in variable set.
Please help me on this.
Thanks,
Meghana P
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2019 02:35 AM
Ah oke.
At least this is wrong:
var mrvs =current.variables.extra_volume.getDisplayValue()
The .getDisplayValue() will cause the undefined. Also see my example, I didn't use the getDisplayValue().
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
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-15-2019 02:44 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2019 02:48 AM
Not sure if this could be caused by the gs.addInfoMessage(). If you use gs.info(), is it then displayed correctly in your System Log?
Also double check if the internal_name of your Multi-Row Variable Set is exactly "extra_volume".
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
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-15-2019 12:24 AM
Hi,
This is how you can get the variables inside MRVS.
//Script Include
var GetSODMRVS = Class.create();
GetSODMRVS.prototype = Object.extendsObject(AbstractAjaxProcessor, {
asset : function() {
var mrvs;
var arrayOfObjs = [];
var ritm_number = this.getParameter('sysparm_ritm_id');
var itemID = '70506da8db002300e69dfbef2996194a';
var ritmGR = new GlideRecord('sc_req_item');
if (ritmGR.get(ritm_number)) {
mrvs = ritmGR.variables.asset_details; //MRVS Variable name
}
var rowCount = mrvs.getRowCount();
for (var i = 0; i < rowCount; i++) {
var row = mrvs.getRow(i);
arrayOfObjs.push({
ip_address: row.ip_address,
host_name: row.host_name,
sid: row.host_name,
device_id: row.device_id,
mac_address: row.mac_address
});
}
return JSON.stringify(arrayOfObjs);
},
type: 'GetSODMRVS'
});
Then call this acript include in your run script block and access it.
Thanks,
Vinitha.K
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2019 12:43 AM
Hi,
Thanks for the response..
The values returns to be "undefined".
How do I handle that ?
Thanks,
Meghana P