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 12:13 AM
Hello meghana,
Check out this article:
Scripting the Multi-row Variable Set
Please mark as Correct Answer and Helpful, if applicable.
Thanks!
Abhishek Gardade
Hexaware Technologies
Abhishek Gardade

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2019 12:35 AM
That's correct, because in the JSON the sys_id is stored for the reference. Thru scripting it is very good changable, so you get the displayValue for example.
Though, what is it actually that you want to achieve in your Catalog Item. What are you exactly trying to achieve? For example, you could also have 3 records in your JSON, do you want for al those 3 records the displayValue? And where/when in your Catalog Item? Is that within the MRVS, outside the MRVS, onChange of a certain other variable, etc?
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 01:02 AM
Mark,
If we consider the above variable field, to access the value of that field I write a statement telling
var projectName =current.variables.project_name.getDisplayValue() and use projectName wherever needed.
I get proper value whatever is displayed
Likewise, how do I read the value of variable set with respect to the below snap of variable set
If I define diskSpace = current.variables.variable_set_name.getDisplayValue(),It returns undefined.
But in the logs I can see the value to be [ {"disk_space1" : "67"}, {"disk_space1" : "78"} ].
Do I have to parse the value and then stringify?
Please let me know your comments.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2019 01:20 AM
The project name field you are now displaying in your image, just looks like a string field. So no .getDisplayValue() needed.
Though again, when/where do you want to have this value available? Is this within your Catalog Item, onChange? Is this after submission, within your workflow?
About retrieving the information of your Multi-Row Variable Set, I guess you are doing this in a workflow? Run Script utility?
You could already access the JSON with:
current.variables.internal_name_of_your_mrvs
No need for the getDisplayValue();
What exactly do you want to parse? Just the values? Or also the field name? Or even field label? What should be parsed if you have multiple rows?
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 01:51 AM
Exactly,
I am doing it in Run script Utility .
Yes, I tried using current.variables.internal_name_of_your_mrvs .I get "undefined".