SuccessFactors Integration
Configuration Requirements
API Endpoint
https://[API-Server]/odata/v2/[Entity]/$metadata
Authorization
Basic Base64(username@companyId:password)
Supported Filters
eq, in, and, or, ge, le, not, like, etc.
$filter=username eq '[email protected]' and location in 'In','Eu'
Employee Profile
Active Employee
curl --location --request GET 'https://api44.sapsf.com/odata/v2/User?$filter=username%20eq%20%[email protected]%27&$format=json' \
--header 'Authorization: Basic XXXXX'
Deactivate / Ex-Employee
curl --location --request GET 'https://api44.sapsf.com/odata/v2/User?$filter=username%20eq%20%[email protected]%27%20and%20status%20eq%20%27f%27&$format=json&$select=defaultFullName,userId,jobCode,email,hireDate' \
--header 'Authorization: Basic XXXXX'
Employment Termination Info
curl --location --request GET 'https://api44.sapsf.com/odata/v2/EmpEmploymentTermination?$filter=userId%20eq%20300&$format=json' \
--header 'Authorization: Basic XXXXX'
Leave Management
SuccessFactors Leave Entities
| Entity | Description | 
|---|---|
| Time Account Type | Rules to accrue balance for each leave type | 
| Time Type | Types of leave (e.g., Annual Leave, Sick Leave) | 
| Time Profile | Leave types applicable to employees | 
| Time Account | Holds the obtained leave balance | 

Managing Time Off Entities
- Log in to SuccessFactors with admin access.
 - Search for Manage Time Off Structure.
 - Select desired entity from dropdown.
 - Select a record to update.
 - Take Action → Make Correction → Save.
 
Adding a New Record
Use the right-side dropdown to select entity category and add a record.
Assigning Time Profile to Employee
- Search employee in the top search bar.
 - Go to Job Information → Edit.
 - Update time profile, work schedule, holiday calendar.
 - Save changes. A time account is auto-created.
 

Sample Config
- Time Profile: Time off Test (
TIME_OFF_TEST) - Time Types:
- Sick Leave: 
SICK_LEAVE - Annual Leave 2: 
ANNUAL_LEAVE 
 - Sick Leave: 
 
Leave Balance Calculation
Past Leaves (Response1)
curl --location --request GET 'https://api44.sapsf.com/odata/v2/EmpTimeAccountBalance?$filter=userId%20eq%20%27273%27%20and%20timeAccountType%20eq%20%27SICK_LEAVE%27&$format=json' \
--header 'Authorization: Basic XXXXX'
Future Approved Leaves (Response2)
curl --location --request GET 'https://api44.sapsf.com/odata/v2/EmployeeTime?$filter=userId%20eq%20%27273%27%20and%20timeType%20eq%20%27ANNUAL_LEAVE%27%20and%20startDate%20ge%20datetime%272020-02-04T00:00:00%27%20and%20approvalStatus%20eq%20%27PENDING%27&$format=json&$select=deductionQuantity,approvalStatus,timeType,endDate,startDate,externalCode' \
--header 'Authorization: Basic XXXXX'
Final Balance Formula
finalBalance = Response1.balance - SUM(Response2[].deductionQuantity)
Apply Leave
curl --location --request POST 'https://api44.sapsf.com/odata/v2/upsert?workflowConfirmed=true&$format=json' \
--header 'Authorization: Basic XXXXX' \
--header 'Content-Type: application/json' \
--data-raw '{
    "__metadata": {
        "uri": "https://api44.sapsf.com/odata/v2/EmployeeTime('273')"
    },
    "startDate": "{{todayDate}}",
    "endDate": "/Date(1611792000000)/",
    "externalCode": "TRY1234",
    "approvalStatus": "PENDING",
    "userIdNav": {
        "__metadata": {
            "uri": "https://api44.sapsf.com/odata/v2/User('273')",
            "type": "SFOData.User"
        }
    },
    "timeTypeNav": {
        "__metadata": {
            "uri": "https://api44.sapsf.com/odata/v2/TimeType('SICK_LEAVE')",
            "type": "SFOData.TimeType"
        }
    }
}'
Sample Responses
Failure:
{
  "d": [
    {
      "key": "EmployeeTime/externalCode=TRY1234",
      "status": "ERROR",
      "message": "Expected return date must be one day later than end date.",
      "httpCode": 500
    }
  ]
}
Success:
{
  "d": [
    {
      "key": "EmployeeTime/externalCode=TRY1234",
      "status": "OK",
      "editStatus": "UPSERTED",
      "httpCode": 200
    }
  ]
}
Verification in Portal
- User Profile: Navigate to User Profile → Actions → Manage leave of absence.
 - Manage Data: Go to Manage Time Off Structures → Employee Time → [externalCode]