how to fetch data on multi row variable set from the request table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2023 10:02 PM
hi
I have below requirement
we have a record producer form
we have 3 variables
type: New, View
Requested for
Reason
Hire date
Amount transferred
type = New
It will create New Request in my Request table
type = View
It will show data which we submitted
on my View form we have
type: New, View
Requested for
Reason
Multi Row variable set below two variables
Hire date
Amount transferred
I am not understanding The request submitted data to view under multi Row variable set ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2023 10:32 PM
Hi @lakshman nalla ,
It is not clear but if you want to access the MRVs then those will stored as a array of objects. You need to access that array of objects as below.
Refer below.
var obj=[
{
"Name":"Ram",
"shortdesc":"Test1",
"ID":"496",
},
{
"Name":"John",
"shortdesc":"Test2",
"ID":"876",
}
]
for(var i=0; i<obj.length;i++){
gs.info(obj[i].Name);
}
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2023 10:58 PM - edited 12-11-2023 11:04 PM
Hello @Lakshman_Nalla,
For a multi-row variable set, the values you will receive are in an array object. For example, if Location, Department, and Manager are the variables in the multi-row variable set.
and their backend names are location, department, and manager, when you fetch the value you will get the values in an array object as below
var arrObj =
[
{
"location" : "value" ,
"department" : "value",
"manager" : "value"
}
]
for(var j=0 ;j<arrObj.length;j++){
gs.info(arrObj[i].location);
}
For you reference .I'm attaching the screenshot that how we get values -
Please mark ✅ Correct if this resolves your issue, and also mark 👍 Helpful if you find my response valuable based on its impact.
Regards,
Astik Thombare
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2023 09:41 PM
Hi @lakshman nalla ,
If my answer helps you to resolve the issue accept the solution and it will be helpful for other users.
If not update about the issue.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar