and more in a single search tool across platforms. Read the announcement here. |
11/02/2023 12:29 PM
Hi -
I found this example of how to store objectList data from a REST import for useror account attributes, and only store one item from the array. Developers Handbook (saviyntcloud.com)
{
"connection": "acctAuth",
"url": "<specify URL>",
"httpMethod": "GET",
"httpHeaders": {
"Accept": "application/json"
},
"userResponsePath": "d.results",
"colsToPropsMap": {
"username": "username",
"systemUserName": "username~#~char",
"email": "#CONST#${List responseList = response.empInfo.personNav.emailNav.results; int count = 0; int size = responseList.size(); Iterator iterator = responseList.iterator(); while (iterator.hasNext()){count++; Map dataMap = iterator.next(); if('312'.equals(dataMap.emailType)){return dataMap.emailAddress}else if(count == size){return null}}}~#~char",
"customproperty15": "#CONST#${List responseList = response.empInfo.personNav.emailNav.results; int count = 0; int size = responseList.size(); Iterator iterator = responseList.iterator(); while (iterator.hasNext()){count++; Map dataMap = iterator.next(); if('310'.equals(dataMap.emailType)){return dataMap.emailAddress}else if(count == size){return null}}}~#~char",
"customproperty13": "#CONST#Internal~#~char"
}
}
I have sample data similar to the following from a REST endpoint:
{
"total": 47,
"limit": 100,
"offset": 0,
"data": [
{
"activated": "2023-03-16T20:26:20.718Z",
"config": {
"locale": "en_US"
},
"created": "2023-03-16T16:22:36Z",
"emails": [
{
"value": "user@contoso.com",
"primary": true
}
],
"enabled": true,
}
If I store emails.value into an attribute, it comes back as [user@contoso.com]. I believe this is because it is part of an array.
The desire is to search the array and where a value is found where primary=true, store that value. Can you please provide a suggestion using the documentation sample above? I have tried several versions of the documented solution, and each time I get a data truncation error when running the import job complaining that the attribute I'm storing is too long for the customproperty.
11/06/2023 11:07 AM - edited 11/06/2023 11:07 AM
Can you try to collect/convert the data to string
.collect{it.toString()}
and then use replace function to replace [ ]with '' blank value
.replace('[','').replace(']','')