Hi all,
I am configuring a rest endpoint to populate a custom field with the results of an external API, as explained in the documentation for "Select List Conversions" in scriptrunner (https://scriptrunner.adaptavist.com/latest/jira/behaviours-conversions.html)
The issue I am having is that when I test the API in a browser, as explained in the document, I am getting an empty value:
{"items":[]}
That is most likely because I might be missing something in the loop where the actual values are gathered:
rt = [
items : persons["response.persons"].collect { Map person ->
def personfirstName = person.core?."firstName"
[
value: personfirstName,
]
},
]
Here is the extract of the jason payload:
"response": {
"noOfRecords": 10,
"apiVersion": "3.0",
"params":
{ "omitNullFields": "true", "limit": "10", "q": "pappas", "offset": "1" }
,
"persons": [
{
"lastUpdateDate": "2019-08-29T09:44:30Z",
"core": {
"gocOfficeCode": "FIR",
"gocOfficeClusterCode": "FI",
"gocDepartmentId": 58034,
"jobRoleSubCategoryName": "n/a",
"jobRoleSubCategoryId": 1393714,
"firstName": "Michael",
I need to loop on the "persons" array to get the value for "firstName", which is under "core". And the "persons" array is under "response".
In the example in the documentation for the github repos, "items" is an array which is not under anything else, but in my case, "persons" array is under "response" so I am not quite sure how to access that.
Thank you for your assistance