how to retrieve multi row variable set in servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2023 05:42 PM
Hi everyone,
i am facing issue with below scenario:
there is multi row variable set as below
selection is name of multi row variable set
variables are Ac Number and No of AC
there is a table in native UI AC Storage table(ac_storage_table)
when i submit the below request from portal by selecting 3 different values of AC numbers it should create 3 different requests in ac_storage table .
i have written below script in Record producer, but not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2023 06:13 PM - edited 08-13-2023 06:15 PM
Since you have a for loop already with an array, I assume you're storing the MRVS in there?
In the for loop, instead of current.ac_number it should be something like arr[i].ac_number. You need to access the item in the array first, and then the property. A MRVS will be stored like below where each item in the array is a row in the MRVS.
[
{
"variable1" : "value",
"variable2" : "value",
},
{
"variable1" : "value",
"variable2" : "value",
}
]
This is just a guess without seeing the structure of the MRVS or the rest of your code.
When I am working on something like this, I like to log what I am doing either into the system logs or throwing it into a info message.
See here for more info Creating records or a summary from Multi-Row Variable Set
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2023 03:44 PM
- No I am not storing mrvs . As I am using Multi row variable set for first time I don't have idea regarding it , could you please share me sample code I will do it accordingly ???
Thank you.