Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Workday RAAS Array attributes

piyushm
Regular Contributor II
Regular Contributor II

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?

 

4 REPLIES 4

rushikeshvartak
All-Star
All-Star

"customproperty29": "#CONST#set($phoneList = $input.Public_Work_Phones_group) #foreach($phone in $phoneList) #if($phone.deviceType == 'Telephone') ${phone.phoneNumber} #end #end ~#~ char"


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

piyushm
Regular Contributor II
Regular Contributor II

@rushikeshvartak - This is not working. The job goes into infinite loop.

piyushm
Regular Contributor II
Regular Contributor II

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

piyushm_0-1710974480030.png

 

def result = input.Public_Work_Phones_group[0].findAll { it.deviceType == 'Telephone' }.collect { it.phoneNumber }.join(' ')
 

Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.