Skip to Content
0

Successfactors: Odata API to create a time off entry for an employee

May 12, 2017 at 02:12 AM

642

avatar image
Former Member

Hi,

We have a web application which needs to create a time off vacation entry for users in Successfactors. Obviously, we need to use SuccessFactors Odata APIs to do this. We are looking for the specific APIs that we can use to do the following:

1. Query by giving an employee number and get their time off balances

2. Create a time off request for a specific start date and end date and time off type.

Regards

Ravi

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Venugopal G May 26, 2017 at 06:07 PM
0

Hi Ravi,

Check the below entities for your queries.

1. Query by giving an employee number and get their time off balances

https://<hostname>/odata/v2/EmpTimeAccountBalance?$filter=userId eq '<userIdValue>' and timeAccountType eq '<timeTypevalue>'

above service will give you the total leaves for the current year in the property balance.

https://<hostname>/odata/v2/EmployeeTime?$filter=userId eq '<userIdValue>' and (timeType eq '<timeTypevalue>') and (startDate ge datetime'2017-01-01T00:00:00')

in response u can find the property deductionQuantity for the timeType. this is a list of records for the current year. sum all the deduction quantity from the response list.


balances = balance - (sum of deductionQuantity)

2. Create a time off request for a specific start date and end date and time off type.

https://<hostname>/odata/v2/EmployeeTime

Payload:

{ "__metadata" : { "uri" : "http://<hostname>/odata/v2/EmployeeTime", "type": "SFOData.EmployeeTime"}, "startDate": "/Date(1483920000000)/", "endDate": "/Date(1483920000000)/", "externalCode": "<some unique value>", "userIdNav": { "__metadata": { "uri": "https://<hostname>/odata/v2/User('<userId>')", "type": "SFOData.User" }}, "timeTypeNav": { "__metadata": { "uri": "https://<hostname>/odata/v2/TimeType('<timeType>')", "type": "SFOData.TimeType" } } }

Consider the property externalCode which should be unique value always like key parameter while creating.

Regards,

Venu

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

HI Ravi,

Have you tried the solution provided by Venu? Did it work? Thanks

0

Hi Venugopal,

I did try this and I am surprised by the results.

This query delivers the results that is expected, however, I am afraid I have to say, the Workflow doesnt get triggered at all.

Do you have anything specific in mind to make it work?

Thanks,

Kunjal

0
Siddharth Rajora
May 29, 2017 at 06:09 PM
0

also you can get using Integration center also, ie simple querying the data

Share
10 |10000 characters needed characters left characters exceeded
Sathish Venkataraman
Jun 05 at 09:11 AM
0

Hi,

Can I use this Odata EmpTimeAccountBalance to query for multiple userIds and timeAccountType combination? i tried different possibilities and could not get the query to work in CPI.

Thanks

Share
10 |10000 characters needed characters left characters exceeded