Click HERE to see how Saviynt Intelligence is transforming the industry. |
10/17/2023 10:04 AM - edited 10/17/2023 10:08 AM
Hi team,
We're using Rest connection to import users from successfactors.
We have a rehire use case where the user comes with multiple entries in the employmentNav (previous and new assignment - sample response below).
In the import user json, we're mapping start date as follows:
"STARTDATE": "employmentNav.results[0].startDate~#~datetime",
Can we update the mapping to pick the start date where employment status is active?
Eg. some filter like this employmentNav.results[:].jobInfoNav.results[?(@.emplStatusNav.externalCode == 'A' || @.emplStatusNav.externalCode == 'U' || @.emplStatusNav.externalCode == 'P' )]
I have seen other examples where the response can be parsed as a list of maps to achieve this using #CONST# keyword. However, that would make the connector complex with the same snippet being added across each of the attributes since most of the attributes require this condition.
Can someone assist if they've come across a similar issue integrating SF or any other REST apps?
{
"d": {
"results": [
{
"__metadata": {
"uri": "<url>/odata/v2/PerPerson('10000410')",
"type": "SFOData.PerPerson"
},
"personIdExternal": "10000410",
"customString1": null,
"personId": "72199",
"perPersonUuid": "xxxxxxx",
"lastModifiedOn": "/Date(1697119528000)/",
"personalInfoNav": {
"results": [
{
"__metadata": {
"uri": "<url>/odata/v2/PerPersonal(personIdExternal='10000410',startDate=datetime'2023-10-03T00:00:00')",
"type": "SFOData.PerPersonal"
},
"startDate": "/Date(1696291200000)/",
"firstName": "Samuel",
"lastName": "Taylor",
"namePrefix": null,
"middleName": null,
"preferredName": "Samuel"
},
{
"__metadata": {
"uri": "<url>/odata/v2/PerPersonal(personIdExternal='10000410',startDate=datetime'2023-10-20T00:00:00')",
"type": "SFOData.PerPersonal"
},
"startDate": "/Date(1697760000000)/",
"firstName": "Samuel",
"lastName": "Taylor",
"namePrefix": null,
"middleName": null,
"preferredName": "Samuel"
}
]
},
"personEmpTerminationInfoNav": {
"__metadata": {
"uri": "<url>/odata/v2/PersonEmpTerminationInfo('10000410')",
"type": "SFOData.PersonEmpTerminationInfo"
},
"activeEmploymentsCount": 1
},
"employmentNav": {
"results": [
{
"__metadata": {
"uri": "<url>/odata/v2/EmpEmployment(personIdExternal='10000410',userId='10000410')",
"type": "SFOData.EmpEmployment"
},
"endDate": "/Date(1696377600000)/",
"startDate": "/Date(1696291200000)/",
"userNav": null,
"jobInfoNav": {
"results": [
{
"__metadata": {
"uri": "<url>/odata/v2/EmpJob(seqNumber=1L,startDate=datetime'2023-10-03T00:00:00',userId='10000410')",
"type": "SFOData.EmpJob"
},
"userId": "10000410",
"employeeClass": "206680",
"emplStatus": "1933",
"employmentType": "206692",
"costCenter": "Test_CC_mw01",
"jobTitle": "Finance Assistant",
"managerId": "TEM73035",
"lastModifiedOn": "/Date(1697036533000)/",
"employeeType": "206700",
"location": "xx",
"company": "xx",
"emplStatusNav": {
"__metadata": {
"uri": "<url>/odata/v2/PicklistOption(1933L)",
"type": "SFOData.PicklistOption"
},
"externalCode": "T"
},
"departmentNav": {
"__metadata": {
"uri": "<url>/odata/v2/FODepartment(externalCode='FS_FI_DEP',startDate=datetime'1900-01-01T00:00:00')",
"type": "SFOData.FODepartment"
},
"name_defaultValue": "Finance"
},
"companyNav": {
"__metadata": {
"uri": "<url>/odata/v2/FOCompany(externalCode='xx',startDate=datetime'1900-01-01T00:00:00')",
"type": "SFOData.FOCompany"
},
"name_defaultValue": "yy"
}
},
{
"__metadata": {
"uri": "<url>/odata/v2/EmpJob(seqNumber=1L,startDate=datetime'2023-10-05T00:00:00',userId='10000410')",
"type": "SFOData.EmpJob"
},
"userId": "10000410",
"employeeClass": "206680",
"emplStatus": "1940",
"employmentType": "206692",
"costCenter": "Test_CC_mw01",
"jobTitle": "Finance Assistant",
"managerId": "TEM73035",
"lastModifiedOn": "/Date(1697101434000)/",
"employeeType": "206700",
"location": "xx",
"company": "xx",
"emplStatusNav": {
"__metadata": {
"uri": "<url>/odata/v2/PicklistOption(1940L)",
"type": "SFOData.PicklistOption"
},
"externalCode": "T"
},
"departmentNav": {
"__metadata": {
"uri": "<url>/odata/v2/FODepartment(externalCode='FS_FI_DEP',startDate=datetime'1900-01-01T00:00:00')",
"type": "SFOData.FODepartment"
},
"name_defaultValue": "Finance"
},
"companyNav": {
"__metadata": {
"uri": "<url>/odata/v2/FOCompany(externalCode='xx',startDate=datetime'1900-01-01T00:00:00')",
"type": "SFOData.FOCompany"
},
"name_defaultValue": "yy"
}
}
]
}
},
{
"__metadata": {
"uri": "<url>/odata/v2/EmpEmployment(personIdExternal='10000410',userId='10000413')",
"type": "SFOData.EmpEmployment"
},
"endDate": null,
"startDate": "/Date(1697760000000)/",
"userNav": null,
"jobInfoNav": {
"results": [
{
"__metadata": {
"uri": "<url>/odata/v2/EmpJob(seqNumber=1L,startDate=datetime'2023-10-20T00:00:00',userId='10000413')",
"type": "SFOData.EmpJob"
},
"userId": "10000413",
"employeeClass": "206680",
"emplStatus": "1933",
"employmentType": "206692",
"costCenter": "Test_CC_mw01",
"jobTitle": "Finance Assistant",
"managerId": "TEM73035",
"lastModifiedOn": "/Date(1697119533000)/",
"employeeType": "206700",
"location": "xx",
"company": "xx",
"emplStatusNav": {
"__metadata": {
"uri": "<url>/odata/v2/PicklistOption(1933L)",
"type": "SFOData.PicklistOption"
},
"externalCode": "A"
},
"departmentNav": {
"__metadata": {
"uri": "<url>/odata/v2/FODepartment(externalCode='FS_FI_DEP',startDate=datetime'1900-01-01T00:00:00')",
"type": "SFOData.FODepartment"
},
"name_defaultValue": "Finance"
},
"companyNav": {
"__metadata": {
"uri": "<url>/odata/v2/FOCompany(externalCode='xx',startDate=datetime'1900-01-01T00:00:00')",
"type": "SFOData.FOCompany"
},
"name_defaultValue": "yy"
}
}
]
}
}
]
},
"emailNav": {
"results": [
{
"__metadata": {
"uri": "<url>/odata/v2/PerEmail(emailType='1655',personIdExternal='10000410')",
"type": "SFOData.PerEmail"
},
"emailType": "1655",
"emailAddress": "s.taylor@outlook.com",
"isPrimary": false
},
{
"__metadata": {
"uri": "<url>/odata/v2/PerEmail(emailType='1653',personIdExternal='10000410')",
"type": "SFOData.PerEmail"
},
"emailType": "1653",
"emailAddress": "samuel.taylor2@abc.com",
"isPrimary": true
}
]
}
}
],
"__count": "1"
}
}
Thanks,
Vaibhav
Solved! Go to Solution.
10/18/2023 01:33 PM
Let me check on this and update.
10/23/2023 12:38 AM
@vaibhav ,
10/25/2023 12:08 PM
Thanks @marco, this works however by using the const keyword, I noticed an issue with how null values are being processed.
If for eg. preferedFirstName is null, it will come up as empty in the attribute field. But if it is being used in the pre-processor such as to create a displayName it will print the 'null' string for displayName.
Is this expected? We have to add attribute != 'null' checks in our pre-processors to avoid this.
Any help would be appreciated.
10/25/2023 07:58 PM
@vaibhav In this case your code doesn't actually return null but "null" string. I think you can detect null in the code and return either empty string '' or actual null.