and more in a single search tool across platforms. Read the announcement here. |
03/12/2024 12:32 PM
Hello,
I am trying to import or map phone numbers from workday which are in the format as shown below.
Workday Report
{
"Report_Entry": [{
"CLASS": "Full time",
"Public_Work_Phones_group": [
{
"deviceType": "Telephone",
"phoneNumber": "(222) 5558888"
},
{
"deviceType": "Mobile",
"phoneNumber": "(222) 5559999"
}
],
"EMPLOYEE_LOGIN_ID": "ABC"
}
I need to map phonenumber above to cp29 if deviceType is Telephone
I tried below but it doesn't work event though there is no error.
"customproperty29":"${if (Public_Work_Phones_group.deviceType=='Telephone') {"phoneNumber~#~char"} else {}}"
I also tried below, using example from the guide, but i get an error "data too long for customproperty29"
"customproperty29":"#CONST#${List responseList = response.Report_Entry; int count = 0; int size = responseList.size(); Iterator iterator = responseList.iterator(); while (iterator.hasNext()){count++; Map dataMap = iterator.next(); if(Public_Work_Phones_group.'Telephone'.equals(dataMap.deviceType)){return dataMap.phoneNumber}else if(count == size){return null}}}~#~char",
Is this the correct way to import array data?
03/12/2024 06:34 PM
"customproperty29": "#CONST#set($phoneList = $input.Public_Work_Phones_group) #foreach($phone in $phoneList) #if($phone.deviceType == 'Telephone') ${phone.phoneNumber} #end #end ~#~ char"
03/20/2024 02:28 PM
@rushikeshvartak - This is not working. The job goes into infinite loop.
03/20/2024 03:40 PM - edited 03/20/2024 03:41 PM
I tried with
"customproperty29": "#CONST#set($phoneList = $input.Public_Work_Phones_group[0]) #foreach($phone in $phoneList) #if($phone.deviceType == 'Telephone') ${phone.phoneNumber} #end #end ~#~ char
It sets the script as it is in cp29 ---> set($phoneList = $input.Public_Work_Phones_group[0]) #foreach($phone in $phoneList) #if($phone.deviceType == 'Telephone') ${phone.phoneNumber} #end #end
03/20/2024 10:00 PM