How do I read the values of variables in multi row variable set ?

Meghana11
Kilo Contributor

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.find_real_file.png

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

21 REPLIES 21

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

LinkedIn

run script

find_real_file.png

 

displayed value

find_real_file.png

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

LinkedIn

vinitha3
Tera Guru

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

Hi,

Thanks for the response..

The values returns to be "undefined".

How do I handle that ?

Thanks,

Meghana P