Click HERE to see how Saviynt Intelligence is transforming the industry. |
08/28/2024 12:59 AM - last edited on 08/28/2024 02:22 AM by Sunil
Hi,
We are getting below response from Oracle HCM for phones attribute where need to pick PhoneNumber only if PhoneType=WM.
We tried sample code mentioned in the document https://docs.saviyntcloud.com/bundle/Dev-Handbook-REST-v24x/page/Content/Developers-Handbook.htm#imp... of the section Support for storing the objectList data but it is not working for us, Could you please help us with sample code?
ORACLE HCM RESPONSE:
{
"items": [
{
"PersonNumber": "1000001",
"emails": [
{
"EmailAddress": sendmail-test-discard@domain.com,
"EmailType": "W1"
}
],
"externalIdentifiers": [],
"names": [
{
"FirstName": "Abdul Nasir",
"MiddleNames": "******* ",
"LastName": "********"
}
],
"phones": [
{
"PhoneType": "HM",
"CountryCodeNumber": "44",
"PhoneNumber": "3173012345"
},
{
"PhoneType": "WM",
"CountryCodeNumber": "44",
"PhoneNumber": "3173054321"
}
],
.....
JSON we are trying:
"customproperty65": "#CONST#${List responseList = response.items.phones; int count = 0; int size = responseList.size(); Iterator iterator = responseList.iterator(); while (iterator.hasNext()){count++; Map dataMap = iterator.next(); if('HM'.equals(dataMap.PhoneType)){return dataMap.PhoneNumber}else if(count == size){return null}}}~#~char",
Import Result:
Code is copied to customproperty65
[This message has been edited by moderator to mask sensitive information]
Solved! Go to Solution.
08/28/2024 07:22 AM
Share full json
08/28/2024 08:26 AM - last edited on 08/28/2024 11:23 AM by Sunil
Response JSON:
{
"items": [
{
"PersonNumber": "1000001",
"emails": [
{
"EmailAddress": "sendmail-test-discard@oracle.com",
"EmailType": "W1"
}
],
"externalIdentifiers": [],
"names": [
{
"FirstName": "Mughees",
"MiddleNames": null,
"LastName": "Skinner"
}
],
"phones": [
{
"PhoneType": "W1",
"CountryCodeNumber": "353",
"PhoneNumber": "9523012345"
},
{
"PhoneType": "HM",
"CountryCodeNumber": "353",
"PhoneNumber": "31781054321"
}
],
"workRelationships": [
{
"WorkerType": "E",
"LegalEmployerName": "Saviynt IE",
"StartDate": "2021-07-05",
"TerminationDate": "2022-09-02",
"assignments": [
{
"AssignmentStatusType": "INACTIVE",
"AssignmentStatusTypeCode": "INACTIVE_PROCESS",
"ActionCode": "TERMINATION",
"AssignmentName": "Actuary",
"AssignmentNumber": "E100001",
"JobCode": "JOB_01680",
"UserPersonType": "Fixed Contractor",
"BusinessUnitName": "SIE",
"BusinessUnitId": 300000002766828,
"DepartmentId": 300000099385869,
"DepartmentName": "811201 Reporting",
"LocationCode": "LOC_GREEN",
"assignmentsDFF": [
{
"company": "AESL"
}
],
"managers": []
}
]
},
{
"WorkerType": "E",
"LegalEmployerName": "Group IE",
"StartDate": "2023-06-26",
"TerminationDate": null,
"assignments": [
{
"AssignmentStatusType": "ACTIVE",
"AssignmentStatusTypeCode": "ACTIVE_PROCESS",
"ActionCode": "REHIRE",
"AssignmentName": "Actuary",
"AssignmentNumber": "E1006958-2",
"JobCode": "JOB_00026",
"UserPersonType": "Employee",
"BusinessUnitName": "Group IE",
"BusinessUnitId": 300000002766828,
"DepartmentId": 300000099385937,
"DepartmentName": "811202 Actuarial",
"LocationCode": "LOC_GREEN",
"assignmentsDFF": [
{
"company": "SLAESL"
}
],
"managers": [
{
"ManagerAssignmentNumber": "E1004255",
"ManagerType": "LINE_MANAGER"
}
]
}
]
},
{
"WorkerType": "P",
"LegalEmployerName": "Group IE",
"StartDate": "2021-06-10",
"TerminationDate": "2021-07-04",
"assignments": [
{
"AssignmentStatusType": "INACTIVE",
"AssignmentStatusTypeCode": "INACTIVE_PROCESS",
"ActionCode": "HIRE",
"AssignmentName": "Actuary",
"AssignmentNumber": "P1006958",
"JobCode": "JOB_01680",
"UserPersonType": "Pending Worker",
"BusinessUnitName": "Group IE",
"BusinessUnitId": 300000002766828,
"DepartmentId": 300000099385869,
"DepartmentName": "811201 Reporting",
"LocationCode": "LOC_GREEN",
"assignmentsDFF": [
{
"company": null
}
],
"managers": []
}
]
},
{
"WorkerType": "P",
"LegalEmployerName": "Group IE",
"StartDate": "2023-06-22",
"TerminationDate": "2023-06-25",
"assignments": [
{
"AssignmentStatusType": "INACTIVE",
"AssignmentStatusTypeCode": "INACTIVE_PROCESS",
"ActionCode": "REHIRE",
"AssignmentName": "Actuary",
"AssignmentNumber": "P1006958-2",
"JobCode": "JOB_00026",
"UserPersonType": "Pending Worker",
"BusinessUnitName": "Group IE",
"BusinessUnitId": 300000002766828,
"DepartmentId": 300000099385937,
"DepartmentName": "811202 aand",
"LocationCode": "LOC_GREEN",
"assignmentsDFF": [
{
"company": null
}
],
"managers": []
}
]
}
]
},
{
"PersonNumber": "1007031",
"emails": [
{
"EmailAddress": "sendmail-test-discard@oracle.com",
"EmailType": "W1"
}
],
"externalIdentifiers": [],
"names": [
{
"FirstName": "Codey",
"MiddleNames": null,
"LastName": "Sachdev"
}
],
"phones": [],
"workRelationships": [
{
"WorkerType": "C",
"LegalEmployerName": "Group UK",
"StartDate": "2021-06-16",
"TerminationDate": null,
"assignments": [
{
"AssignmentStatusType": "ACTIVE",
"AssignmentStatusTypeCode": "ACTIVE_NO_PROCESS",
"ActionCode": "ASG_CHANGE",
"AssignmentName": "Contractor",
"AssignmentNumber": "C1007031",
"JobCode": "JOB_01158",
"UserPersonType": "Managed Services ",
"BusinessUnitName": "Group",
"BusinessUnitId": 300000002766815,
"DepartmentId": 300000002782252,
"DepartmentName": "113103 IT Management",
"LocationCode": "HOUSE",
"assignmentsDFF": [
{
"company": "SLAESL"
}
],
"managers": [
{
"ManagerAssignmentNumber": "C17819",
"ManagerType": "LINE_MANAGER"
}
]
}
]
}
]
}
],
"count": 10,
"hasMore": true,
"limit": 10,
"offset": 0,
"links": [
{
"rel": "self",
"href": "https://domain.com:443/hcmRestApi/resources/11.13.18.05/workers ",
"name": "workers",
"kind": "collection"
}
]
}
[This message has been edited by moderator to mask sensitive information]
08/28/2024 07:30 AM
Hi @ghrk is items a list field used in connection?
08/28/2024 08:32 AM
not sure what it means, but we have "userResponsePath": "items", in the ImportUserJSON
08/28/2024 08:41 AM
Share full ImportUserJSON‼️‼️⚠️Keep company-specific private information masked on public forums, such as the name and URL.⚠️‼️‼️
08/28/2024 08:47 AM
Hi @ghrk ,
Try this
"customproperty65": "#CONST#${List responseList = response.phones; int count = 0; int size = responseList.size(); Iterator iterator = responseList.iterator(); while (iterator.hasNext()){count++; Map dataMap = iterator.next(); if('HM'.equals(dataMap.PhoneType)){return dataMap.PhoneNumber}else if(count == size){return null}}}~#~char",
09/04/2024 02:35 AM
response.phones worked thanks, I have similar problem and posted in another post, could you please check and help? https://forums.saviynt.com/t5/identity-governance/nested-object-iterations-in-rest-oracle-hcm-connec...
09/18/2024 06:34 AM