The Zurich release has arrived! Interested in new features and functionalities? Click here for more

how to fetch data on multi row variable set from the request table

lakshman nalla
Tera Contributor

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 ?

3 REPLIES 3

Pavankumar_1
Mega Patron

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);
}

Screenshot 2023-12-12 at 12.00.59 PM.png

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

Astik Thombare
Tera Sage

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.

 

AstikThombare4_0-1702363896574.png

 

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 -

AstikThombare4_1-1702364457481.png

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

 

Pavankumar_1
Mega Patron

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.

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar