How to change the Hire Date of the employee in SAP Successfactors via OData API call?

Innosense
4 min readJul 16, 2020

--

This article deals with how the hire date can be changed for the Employee over OData call.

I have been inspired to write about this by Mr, Ravi Varma over a query posted on my course on Udemy : SAP Successfactors Odata and SFAPI API-How to work with them. Thank you Sir!

So, the problem statement is :

Let’s say there is an employee who is going to join on 07 August 2020 so there is an EmpJob record created in Successfactors with a startDate as 07 August 2020 as shown below:

Employee Joining Date — Anticipated

But now, let’s say it happens that the employee would be joining on 11 August 2020 instead of 7 August , so what we could do is from the front end in the Correction mode edit the entry to reflect the startDate to 11 August 2020, as shown below:

Modify startDate and Save it

and there remains only one record (i.e. previous record is overridden) , as the changes were made in the correction mode:

Changes done in correction mode , hence the previous entry was overridden.

Now, let’s see how to achieve the same with the OData API calling.

So, deleting the EmpJOb record from the front-end , so there is no entry for the EmpJob currently as shown below:

Deleting the EmpJob entry

So, at the first place let’s create the record first for the 07 August 2020 via the API calling, which we can achieve as follows:

In case you are curious to know how the following OData payload is being defined (including what are the date time values to pass, which fields and what are the valid values etc), please consult an in depth study in the course link provided above.

The below payload is sent to Successfactors over HTTP operation POST and the URI as follows:

https://<Data Center Host>:443/odata/v2/upsert?$format=JSON

{
“__metadata”: {
“uri”: “https://apisalesdemo4.successfactors.com:443/odata/v2/EmpJob(seqNumber=1L,startDate=datetime'2020-08-07T00:00:00',userId='103264')",
“type”: “SFOData.EmpJob”
},
“userId”: “103264”,
“startDate”: “/Date(1596758400000)/”,
“payScaleType”: “USA/US4”,
“timezone”: “US/Eastern”,
“jobTitle”: “Analyst”,
“jobCode”: “50012557”,
“company”: “1710”,
“position”: “3000994”,
“eventReason”: “HIRNEW”,
“payScaleArea”: “USA/US2”,
“managerId”: “103244”
}

The payload above got the double quotes fancied ones but the actual payload on the Postman looks as follows:

and we get the following response:

And on the Successfactors front end we also get the EmpJob entry been made as shown :

Now, let’s try to change the startDate from 07 August to 11 August as shown below:

Now, since this is the first record and the hire record so we can achieve that by following:

Make the upsert call again but with the option purgeType=full as shown below:

URI : https://apisalesdemo4.successfactors.com:443/odata/v2/upsert?$format=JSON&purgeType=full

Payload (same as before but here the dates are changed to 11 Aug):

{
“__metadata”: {
“uri”: “https://apisalesdemo4.successfactors.com:443/odata/v2/EmpJob(seqNumber=1L,startDate=datetime'2020-08-11T00:00:00',userId='103264')",
“type”: “SFOData.EmpJob”
},
“startDate”: “/Date(1597104000000)/”,
“payScaleType”: “USA/US4”,
“timezone”: “US/Eastern”,
“jobTitle”: “Analyst”,
“jobCode”: “50012557”,
“company”: “1710”,
“location”: “1710–2001”,
“position”: “3000994”,
“eventReason”: “HIRNEW”,
“payScaleArea”: “USA/US2”,
“managerId”: “103244”
}

It looks as following in the Postman tool:

And the response is gathered as follows:

Following is how it shows up in the Successfactors front-end:

So, here the same new hire record for date 07 Aug is changed to the 11 Aug 2020.

--

--

Innosense
Innosense

Written by Innosense

A Seeker, Researcher, Integration Architect, AI/ML, Data Engineer, Big Data Architect, Avid Enthusiast; strive to remain humble and a good human being.

No responses yet