Click HERE to see how Saviynt Intelligence is transforming the industry. |
07/16/2024 08:55 AM
Hi All,
We have to onboard HR app using Rest connector.
The data coming from HR is not in "Key":"Value" format.
But is in a different format:
[{
name:"Company",
value:"Microsoft"
},
{
name:"Department",
value:"Finance"
}]
Is there a way to map this kind of response in import user json.
PFA the sample response of API.
Regards,
Abhay Yadav
07/16/2024 09:18 AM
Hi @Abhay_Yadav , yes you can
Do like this"additionalfield[0].value"
07/17/2024 01:27 AM - edited 07/17/2024 01:27 AM
Hi @NM,
This will work assuming that response is always in same order for all users. What if response is not in same order or few entries for users are not coming in the response.
How can we fetch the value based on "Name" field.
Regards,
Abhay Yadav
07/16/2024 09:25 AM
07/17/2024 02:27 AM
Hi @rushikeshvartak ,
Can you please help me with the section/page of the document that has this kind of response mapping.
Regards,
Abhay Yadav
07/17/2024 09:11 PM
Do like this "additionalfield['Department'].value"
07/18/2024 12:42 AM - edited 07/18/2024 12:44 AM
Hi @rushikeshvartak,
"additionalFields['Job_Title''].value" is throwing below error.
Regards,
Abhay Yadav
07/18/2024 01:03 AM - edited 07/18/2024 01:05 AM
Hi @rushikeshvartak ,
I tried this also but it's getting stored as a string instead of getting processed.
${List responseList = response?.data?.additionalFields; int count = 0; int size = responseList.size(); Iterator iterator = responseList.iterator(); while (iterator.hasNext()){count++; Map dataMap = iterator.next(); if('Job_Title'.equals(dataMap.name)){return dataMap.value}else if(count == size){return null}}}
07/18/2024 10:24 AM
IN that case you have syntax issue
07/22/2024 08:40 AM
Hi @rushikeshvartak ,
I tried multiple things but does not seem to be working. Can you please help me with the correct syntax based on the response attached in first comment.
Regards,
Abhay Yadav
07/22/2024 08:42 AM
Please share full json
07/22/2024 08:47 AM
07/22/2024 08:51 AM
"customproperty60": "#CONST#${List responseList = response?.data?.additionalFields; int count = 0; int size = responseList?.size() ?: 0; Iterator iterator = responseList?.iterator() ?: [].iterator(); while (iterator.hasNext()) { count++; Map dataMap = iterator.next(); if ('Job_Title'.equals(dataMap.name)) { return dataMap.value } else if (count == size) { return null } }}~#~char"