How do I access MultiRow Variable set on workflow?

Hardik Benani
Mega Sage
Mega Sage

How do I access MultiRow Variable set on workflow?

I have tried current.variables.<mrvs_name> - Result: Blank Array

I have tried current.variable_pool.<mrvs_name> - Result: Blank Array

Tried:

var mrvs; var itemID = '<sys_id_of_ritm>';

var ritmGR = new GlideRecord('sc_req_item');

if (ritmGR.get(itemID)) { mrvs = ritmGR.variables.access_list; } - Result: undefined.

Running the above query in background script does return proper result.

4 REPLIES 4

Raf1
Tera Guru

Hi Hardik,

This article from Brad is a good reference:

https://community.servicenow.com/community?id=community_blog&sys_id=865b5aeddbc023c0feb1a851ca9619f9

 

Regards,

Raf

Thanks Raf, but this doesn't seems to work. Also tried below mentioned in the article, for some reason it always gives be defined or blank array.

var mrvs; var itemID = '70506da8db002300e69dfbef2996194a';

var ritmGR = new GlideRecord('sc_req_item');

if (ritmGR.get(itemID)) { mrvs = ritmGR.variables.access_list; } 

Hi Hardik,

Would you be able to provide the error you are receiving?

I tried a simple catalog item with a Multi-Row Variable set with internal name of "mrvs". I added the following line to the Workflow RUN Script activity:

gs.log("MRVS: " + current.variables.mrvs);

And I can see the following entry in the system log:

MRVS: [ {
"name" : "First"
}, {
"name" : "Second"
} ]

If you could share the error you are receiving, it would be helpful.

Thanks,

Manish

Ajay37
Tera Contributor

Hi @Hardik Benani ,

I am facing the same issue now. Unable to access the mrvs from runscript, checked in logs and got an blank array. Could you please let me know how you resolved this?

Thanks