How to Populate List collector field value from postman

Community Alums
Not applicable

Hi There,

 

Here i need to create a new Request from Postman Application, and for this i have written one scripted Rest API and one Script Include (To get the values of the Reference fields), and i'm getting values for that, 

 But now i need to get the values of the List collector fields, 

So how can i write the code to get the Listcollector field values.

 

Can somebody please help me how can get the values of list collector fields.

 

 

Thanks,

 

2 REPLIES 2

Voona Rohila
Kilo Patron
Kilo Patron

Hi @Community Alums 

You can simply use object.fieldname to get the value.

 

var list = current.<<list_field_name>>.toString();


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Community Alums
Not applicable

Hi @Voona Rohila,

 

Thanks for your response, i have tried the code in scripted Rest API, which you mentioned but still i'm getting the field value is empty,

when i used Current.fieldname

at that time i was getting an error in Postman, and now i have tried the below code

var list = request.body.data.officer_group_approval.toString();
  cart.setVariable(item, 'officer_group_approval', list);  (officer_group_approval- field name)
when i run this code from Postman, the Request is creating but list collector field is showing empty.
 
So could you please help me how can i modify the code, is there any need of writing Script Include!!
 
Thanks,