Level Up Your Leave: Master SuccessFactors Time Off in Slack

Tal Levy
Riskified Tech

--

As more and more companies centralize their work around high-quality productivity tools for collaboration (like Microsoft Teams or Slack), the demand for notification automation and transactions to and from them has become increasingly frequent.

Those demands come from management as well as employees. The reasons are clear — it’s quick and easy and available from everywhere, which means fewer systems to access and the ability to receive real-time notifications.

Recently, we at Riskified have replaced our HRIS system with SuccessFactors. During this transition, we lost the ability to request and approve Time Off via Slack. This change had a significant negative impact on the employees, so we knew we had to find a solution for it. We couldn’t find a SuccessFactor/Slack connection to solve this problem and wanted our employees to retain this beneficial capability, so we had to build one ourselves.

Bird’s-eye view of process

In this blog post, we’ll look at:

  • Why we decided to implement a solution ourselves
  • How we tackled this problem
  • What tools you’ll need if you want to do the same
  • Step-by-step instructions to connect SuccessFactors’ “Time Off” with Slack

How We Made Slack and SuccessFactors Play Nicely Together

Let’s dive into how we made the magic happen. Here’s the high-level plan for a straightforward time off request:

Scenarios:

Using SuccessFactors API

When we started playing around with SuccessFactors API, we ran into a snag. It turned out that the API requests were setting all of our requests to “Approved” right away, but we wanted them to go through the whole approval process.

At this point, we turned to Google to try and find a solution; we even opened a ticket to SAP.

It turned out that this was a standard SuccessFactors behavior, but we wouldn’t settle for that.

You see, workflows are a great tool in SuccessFactors, and we needed to trigger them via SuccessFactors API.

Changing Role-Based Permissions (RBP) was the trick here. It took some maneuvering, but we got it to work.

However, we ran into more problems. All requests were being routed for approval, even ones that didn’t need to be. Furthermore, we couldn’t approve workflows through the API because the manager had to be the approver.

Combining What Works

At this point, we realized that one connection and one user wouldn’t cut it. We needed a more comprehensive approach, including the following:

  • SuccessFactors Admin Center (RBP)
  • SuccessFactors Admin Center (Integration Center)
  • Postman (optional — we used it for testing)
  • An integration tool (we used Workato)

Step 1: SuccessFactors RBP Setup

To kick things off, we needed two SuccessFactors API users.

The first is to create “Time Off” requests with an “Approved” status.

RBP: With Metadata Framework and Admin access to MDF OData API (let’s call this API user1).

“Admin access to MDF OData API” would create all requests with the status “Approved”.

The second is to create “Time Off” requests with a “Pending” status and trigger the relevant workflow.

RBP: Without Metadata Framework and Admin access to MDF OData API (let’s call this API user2).

Only a non-admin user can trigger a workflow on an OData call.

The process had to check if the “WorkflowConfiguration” field for the “TimeType” required approval. If that were the case, we would have needed to use the API connection without Admin access to MDF OData API (API user2).

Checking the “TimeType” configuration is doable using the following API call (Get):

https://api55.sapsf.eu/odata/v2/TimeType?$format=Json

***https://api55.sapsf.eu/ is the server’s location. Check where your server is located and change the domain***

In this example, the WorkFlow “TO_MGR_NOT” is set for manager notifications only. Therefore, no approval process is required, and we would use the connector with the user “API user1”.

Step 2: SuccessFactors MDF Setup — Time Off Request

Now, let’s dive into the details of configuring a Time Off request in SuccessFactors:

Configure the Time Off request workflow: We needed to make a specific change to the Time Off request object by adding the “approval manager workflow” to it. This step was crucial because it ensured Time Off requests were sent to the right people for approval.

In this example, the ‘TO_MGR_APPR’ workflow was the one we set up for manager approval, ensuring requests ended up in their inbox for a response.

API call and confirmation: When creating a Time Off request using the API (which needs approval), remember to include “workflowConfirmed=true”. This flag ensures the workflow triggers properly, even when we create the request using SuccessFactors API.

When we trigger workflows from the UI, we see a popup asking for confirmation. This flag denoted this behavior when creating a request from SuccessFactors API.

Here’s an example of how to create a Time Off request with the “Pending” status:

API Endpoint: POST

https://api55.sapsf.eu/odata/v2/EmployeeTime?workflowConfirmed=true

Request Body:

{
"__metadata": {
"uri": "http://api55.sapsf.eu/odata/v2/EmployeeTime",
"type": "SFOData.EmployeeTime"
},
"userIdNav": {
"__metadata": {
"uri": "https://api55.sapsf.eu/odata/v2/User(1234)",
"type": "SFOData.User"
}
},
"timeTypeNav": {
"__metadata": {
"uri": "https://api55.sapsf.eu/odata/v2/TimeType('ISR_HOL_FT')",
"type": "SFOData.TimeType"
}
},
"endDate": "/Date(1687509224000)/",
"startDate": "/Date(1687422824000)/",
"userId": "1234",
"timeType": "ISR_HOL_FT"
}

With these steps, you’ll successfully create a Time Off request with the ‘Pending’ status in the system.

Here is how it looks in SuccessFactors:

Step 3: Setting Up SuccessFactors’ Integration Center

Now, let’s address a critical aspect of ensuring seamless communication between Slack and SuccessFactors. The goal is to send Time Off requests to Slack, regardless of their origin — be it Slack itself or SuccessFactors. This step acts as the vital link that harmonizes the two systems.

The Significance of This Step

Creating a Time Off request in SuccessFactors instantly transfers the request to Slack and vice versa. This synchronization is not a matter of magic but rather the creation of a comprehensive integration between the two systems.

Choose the Integration Approach

When facing this challenge, we considered “scheduled integration” or “event-based integration.” We went with “event-based integration” because we wanted things to happen lightning-fast, and this method ensures they do.

Let’s get into the details
Setting Up Integration Configuration:

Please note line 9 in Data Fields — “workflowRequestld”; we will use it later.

Configuring “Event-Based Integration”:

Now, let us configure the core functionality of our process.

Start by establishing a Business Rule for approved Time Off requests.

Similarly, create a rule for non-approved requests.

Integrate with the Time Off object:

Next, integrate these business rules with the Time Off object.

Under “Save Rules,” ensure the “Approved” rule is included.

And under “Post Save Rules,” add the “Non-Approved” rule.

Configure the Intelligent Services Center (ISC):

Step 4: Approve/Decline Time Off Request

You might ask yourself, how do we sync the response to the Time Off request?

Since the API user isn’t the one who approves the request, we had to conceive a solution. We considered two options:

  1. Adding Admin API to approvals (DON’T DO THIS): Our first idea was to include the Admin API user in the approvals but as a parallel approval. We tried this but hit a roadblock — We needed a dynamic group to make it work, and we couldn’t use the manager for approval in that setup. This solution did not work.
  2. Changing approval to “Admin API” User (DO THIS): Then, We decided to change the approval to the “Admin API” user, the same user who sends the API call. We only do this when trying to approve the Time Off request through the API. It involves a few extra steps after approving/declining the request in Slack. We implemented this solution.

Before implementing this solution, please ensure your API user has the necessary Role-Based Permission (RBP):

“Administrator Permissions — Manage Workflows — Manage Workflow Requests”.

Please note that we named our API user “adminAPI”; you can name it as you wish.

a. RBP Setup:
Read about it here, too

b. Get the approval step ID

Remember “workflowRequestld” from step 3? Now we are going to use it.

We make an API call to get the Approval step ID using “wfRequestId” — the same one we sent to the integration center in Step 3.

Here’s the call:

API Endpoint: GET

https://api55.sapsf.eu/odata/v2/WfRequest?$filter=wfRequestId eq '834'&$format=Json&$expand=wfRequestStepNav

c. Change the owner of the approval step

Next, make a POST call to change the owner of the approval step to the API user. Here's the call:

API Endpoint: POST

https://api55.sapsf.eu/odata/v2/changeWfRequestApprover?wfRequestId=834L&wfRequestStepId=839L&updateToUserId='adminAPI'

d. Send the approval request

Finally, send the approval request using this POST call:

API Endpoint: POST

https://api55.sapsf.eu/odata/v2/approveWfRequest?wfRequestId=834L

With these steps, Time Off request approvals and declines are processed even when using the API.

Final Result

HR bot for Time Off requests

Time Off request notification for the manager.

Time Off request notification for the employee.

Workflow Wins: Time Off Without the Wait

Building this Slack-SuccessFactors integration wasn’t just about lines of code and API calls; it was about empowering our employees and making their lives easier by giving them the ability to ask for time off and to receive a response as quickly as possible. We took the challenge head-on, avoided the easy route, and crafted a solution that streamlined Time Off requests and approvals, freeing up valuable time for both employees and managers. A considerable part of the work in this project was implementing the solution in Workato, finding workarounds, and handling issues in the API as we faced them.

Thanks to Kobi Shmerkovich, our Business Integration and Automation Team Lead, whose expertise in Workato was instrumental in creating this game-changing flow!

--

--