Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Script Runner - How to populate Multiple fields with data received from Rest end point

Ash October 2, 2021

Hi Team,

 

I'm trying to achieve following using script runner.

Based on values provided or selected in one field, need to call rest service to fetch data from external APIs, which will return following response in format.

{
"ac": "string",
"acCode": "string",
"acTime": 0,
"cItDTO": {
"coverageId": "string",
"date": "2021-10-03T05:37:02.252Z",
},
"comments": "string",
"currencyCode": "string",
"exchangeRate": 0,
"itDescription": "string",
"itMfgDTO": {
"it": "string",
"mfgCode": "string",
"mfg": "string",
"vendorDTO": {
"vendorCode": "string",
"vendorName": "string"
}
},
"line": "string",
"location": "string",
"pnDTO": {
"averageCost": "string",
"commodity": "string",
"Description": "string"
},
"quantity": "string",
"quotePrice": "string",
"trx": "string",
"trxDate": "2021-10-03",
"uqDTO": {
"Id": "string",
"description": "string",
"type": "string"
   }
}

Need to populate all these values to various fields.

So far i worked on single field population only but no idea to handle multiple field values from json and pass it back to server side script or behaviour script to populate multiple fields in that issue screen.

2 answers

1 accepted

1 vote
Answer accepted
Ash October 3, 2021

Got the solution. have written server side script for behaviour.

 

Thanks for your support.

0 votes
Tuncay Senturk _Snapbytes_
Community Champion
October 3, 2021

Hi @Ash 

I might have misinterpreted your question but, once you get this response from external API you can populate as many fields as you can using the response.

Ash October 3, 2021

Thanks Tuncay for your response.

 

the concern here is, how to call rest end point from server side script and get the response to set values in various fields. my all fields are single line text box only. 

and i don't need to convert any field into multi select.

So it's like that:

1. select a value in field 'A'

2. through server side script on field 'A' call rest end point and get the json.

3. parse json and populate values in various fields like x, y , z

 

So my Main concern is step#2 - how to call service from server side and get response.

Ash October 3, 2021

Thanks for your support.

Suggest an answer

Log in or Sign up to answer