Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

SuccessFactors (REST) UserImport advanced filter

vaibhav
New Contributor
New Contributor

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

 

 

4 REPLIES 4

SB
Saviynt Employee
Saviynt Employee

Let me check on this and update.


Regards,
Sahil

marco
Saviynt Employee
Saviynt Employee

@vaibhav ,

"firstname": "#CONST#${List responseList = response.empInfo.personNav.personalInfoNav.results; Map dataMap = responseList.get(responseList.size() - 1); return dataMap.customString6;}~#~char"
 
Above is the example of picking the last entry in personalInfoNav. Similar logic can be used to do what you want.

vaibhav
New Contributor
New Contributor

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.

marco
Saviynt Employee
Saviynt Employee

@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.