Skip to Content
Technical Articles
Author's profile photo Sudip Ghosh

SFEC Employee Off boarding Extension using SAP Intelligent BPM and DocuSign

Hello Everyone,

Welcome to my another blog, When we start our journey in professional career, we all go through Employee On-Boarding process which includes contract signing, background verification etc. Similarly when we leave our organization, during exit we all go through certain clearance (IT Clearance, Finance Clearance, HR Clearance etc) and after all these clearance Employee get their experience certificate or relieving letter. In most of the organization processes are quite complex, manual and most of the clearance still not seamlessly Integrated with core Employee Central System. So in this Blog we will see how we can simplify the Employee Off boarding Clearance process using SFEC, SAP Intelligent BPM and DocuSign. More over we will see how we can build extension on SAP Cloud Platform without touching the existing core process and System.


Business Story

ABC is a US based company who recently Implemented Intelligent Enterprise Total Workforce Management which includes SAP Hire to Retire Business Process. ABC Company use SAP SuccessFactors Employee Central for Employee On-boarding and Off boarding. Bryan Adams is operational manager of Company ABC who is going to leave the organization. As a exit process every employee goes through certain clearance and Bryan is also not an exception. He also has to go through couple of clearance like others. But guess what Bryan’s employer also implemented  SAP Intelligent BPM based extension to handle this all clearance which makes process more simpler and give best employee off-boarding experience. Because Bryan doesn’t have to do anything except just clearing all the clearance by submitting all the employer’s asset or clearing all the bills and remaining thing will be taken care by the SAP iBPM Automatically.No Manual Stuff and Followup. Best part is once all the clearances are approved, It triggers DocuSign based digitally signed Experience letter.




Technical Explanation

Well by looking at above picture many of you might’ve already figure out what is happening, but still i would like to explain bit of it. A HR person initiate the termination request in SFEC, once Termination request get approved, Termination Event get triggered and SFEC Intelligence Service trigger node.js application with Employee, Business unit and company code information. This node.js application is deployed in SAP Cloud Platform Cloud Foundry which will call Business Rules service to get all the clearance approvers and then call SAP Cloud Platform Workflow Service in order to initiate clearance Workflow, once all clearances (IT, Finance, Asset and HR) will be cleared it will call DocuSign (Open Connectors based) Api to issue Experience letter Digitally Signed By Chief HR.



** Lets break this into smaller pieces for better understanding and then we will connect the each dots.


Breaking this into smaller Pieces

Step 1. Configure Intelligence Service for Employee Termination. Follow the step 7 from this blog to see how to configure Intelligent service for calling rest API.


Choose intelligent Service as Trigger Type, Rest as Destination type, Source Type SuccessFactors and JSON as Format.

In next Screen Select event Employment Termination

Create payload with below JSON

Configure the Destination with deployed Node.js Application into SAP Cloud Platform which will get the Employee information in same JSON format as input and call Business Rules Service to get the Approvers and trigger Workflow. (Node.Js, WF and Business Rules part will be covered in next step). Now Save this.

Step 2. Design the Business Rules for Getting all Approvers

As i said earlier this Business rules will be used for getting the Clearance approver details based on Business Unit, Company Code and Division.

Well if you are new to business rules and still don’t know how to settings things up in cloud foundry, then check out this Awesome YouTube Video by DJ Adams .

You can also start with Interactive SAP Developer Mission. If you want to setup Business Rules service in Cloud Foundry. And Follow this Developer Mission if you want to know how to create project and use Business Rules.

Well as i said earlier this business rules we will be using it for fetching Approver based on business unit, division and company code.

employmentInfo is Input Structure

EmpApprovers is result structure or you can say output structure

This is how Vocabulary or rule service looks like

And here is sample decision table GettingApprover rule in which i have used for this demo

For this particular scenario we have only one rule in Rulesets

**Whole Business Rules project is hosted in this GitHub Repository, you can import and play around.


Step 3. Design the Clearance Workflow using SAP Cloud Platform Workflow

If you are new to setting up Workflow Service in Cloud Foundry, then watch this cool YouTube Video from DJ Adams and Setup your Workflow Service in Cloud Foundry.

If you like SAP Developer Mission, then you can follow this SAP Developer Mission to Setting up Workflow Service in SAP Cloud Platform Cloud Foundry.

If you are new to creating Workflow project as Multi Target Application in Cloud foundry then follow these two below SAP Developer Missions.

Mission 1 – Creating Workflow project and Its Module in Cloud Foundry

Mission 2 –  Add user task to Workflow and Deploy it as MTA Application

Below is How  Workflows Look Like for this scenario

Let me show you Sample Context of Workflow, so it would be clear to everyone

  "division": "MANU",
  "companyCode": "1710",
  "payrollEndDate": "2020-01-11T00:00:00Z",
  "endDate": "2020-01-11T00:00:00Z",
  "lastModified": "2020-01-12T14:12:49Z",
  "userID": "SGHOSH",
  "email": "",
  "Bunit": "PRODS",
  "name": "Sudip Ghosh",
  "financeApprover" : "",
  "ITApprover" : "",
  "AssetApprover" : "",


This Context is being created by Node.Js Application ( Which we are going to Discuss in next step) after calling Business Rules Service (For getting the Approver Details based on company code, Division and Business Unit)

So First Script Task ( Setting Titles) is being used for creating Subject of  each user task (E.G Finance Clearance)

var FinanceTitles = 'Finance Clearance for ' + $,
	HrTitles = 'HR Clearance for ' + $,
	AssetClearanceTitles = 'Asset Clearance for ' + $,
	ITClearanceTitles = 'IT Clearance for' + $;

$.context.FinanceTitles = FinanceTitles;
$.context.HrTitles = HrTitles;
$.context.AssetClearanceTitles = AssetClearanceTitles;
$.context.ITClearanceTitles = ITClearanceTitles;

In this scenario we need parallel gateway because, we need approval from each department and until all the user task get cleared we cant move to next step. In order to read the decision from each user task (Finance, HR, IT, Asset) we need to add  script task after each user task.

var financeDecision = $.usertasks.usertask1.last;
$.context.financeDecision = financeDecision;


Final Decision Script task is being used to determine final decision and adding it into context node based on each user task decision.

var finalDecision;
if ($.context.financeDecision.decision === "approve" &&
	$.context.AssetDecision.decision === "approve" &&
	$.context.HrDecission.decision === "approve" &&
	$.context.ITDecision.decision === "approve") {
	finalDecision = "approved";

	$.context.finalDecision = finalDecision;
} else {
	finalDecision = "reject";

	$.context.finalDecision = finalDecision;


And then we need exclusive gateway in order to make if-else branch, so if final decision is approved then it will move to Docusign  Service Task which will  trigger Docusign Application (Node.js based wrapper) to Generate Digitally Signed Experience Letter.

And below is the Docusign Service task details

Below is Destination used in Docusign Service Task

**This Whole Workflow Project is hosted in this GitHub Repository, You can import and Play around if you want 🙂


Step 4: Creating Node.Js Application for Fetching Approver Details by Calling Business Rules Service and Initiate Clearance Workflow


If you don’t know how to play with Business Rules API then Please follow this Developer Mission.

If you don’t know how to play with Workflow API in Cloud Foundry Please Follow this Documentation.

**Node.JS Application for Handling Workflow and Business Rules is Hosted in this GitHub Repository, Please feel free to import and Play around. (/initiatewf is the express path)

Deploy this Application to Cloud Foundry.

Step 5. Create a Sandbox account in DocuSign and Design the Experience letter template, Please follow this blog to setup DocuSign Sandbox Account and How to design contract or Experience letter.

This is the sample experience letter i have used for this demo.

Step 6. Creating Open Connectors instance for DocuSign, Follow this blog.



Step 7. Creating Wrapper Node.Js Application for Calling Open Connector based  DocuSign API Which will be called from Service Task of Workflow.


**Code is hosted in this GitHub Repository. (Index,js and express path is ‘/sendcontract’)


**Below is the Demo Video, Please have a look and Enjoy.

I hope Everyone Enjoyed this Blog, Feel Free to ask anything in Comment. Will see you in next blog.



Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Shivam Shukla
      Shivam Shukla

      Awesome integration and explanation , especially loved the proxy approvers job .. thanks for always sharing the genuine stuff man.




      Author's profile photo Sudip Ghosh
      Sudip Ghosh
      Blog Post Author

      Thank you so much for your kind words 🙂

      Author's profile photo Nitin Deshpande
      Nitin Deshpande

      Very nice blog and well integrated with Docusign. So many manual processes are automated using this.

      Author's profile photo Sudip Ghosh
      Sudip Ghosh
      Blog Post Author

      Thank You So much 🙂

      Author's profile photo DJ Adams
      DJ Adams

      Great post Sudip, and thanks for the shoutout!

      Author's profile photo Sudip Ghosh
      Sudip Ghosh
      Blog Post Author

      Thank you so much, Your Dev sessions are Awesome 🙂 , Though i never get a chance to join because of my other call but later i enjoy watching your Videos 🙂

      Author's profile photo Avinash Shetty
      Avinash Shetty

      Great Post Sudip.

      Author's profile photo Sudip Ghosh
      Sudip Ghosh
      Blog Post Author

      Thank you so much

      Author's profile photo Chetan Mane
      Chetan Mane

      Great blog Sudip. Gives complete insight of the flow. Thank you.

      Author's profile photo Sudip Ghosh
      Sudip Ghosh
      Blog Post Author

      Thank you so much for your words

      Author's profile photo Sateesh Reddy
      Sateesh Reddy

      Very well explained..

      This the exact solution that most of the organisations wants as a part of exit process and still it is not enabled in SF offboarding module as configurable solution.

      After going through the rollercoaster ride in implementation of sf offboarding module, I started to think how SAP handles offboarding process for its own employees and why the same process is not enabled directly in SF.

      Author's profile photo Sudip Ghosh
      Sudip Ghosh
      Blog Post Author

      Hello Sateesh,

      Thank you so much, Yes that's why you can build as extension which i tried to show here how to do that 🙂



      Author's profile photo PS GOSWAMI

      Awesome! Real essence for any org. Thanks Sudip to figure out the gap here and explaining such nicely.

      Author's profile photo Niladri Bihari Nayak
      Niladri Bihari Nayak

      This is awesome ! 90% of the clients have this kind of scenario. I am not sure why standard Offboarding module 1.0/2.0 doen' t have this capability?


      Please confirm does it require additional license for BPM/SCP - I think so.



      Author's profile photo Sudip Ghosh
      Sudip Ghosh
      Blog Post Author

      Thank you for your comment, you need SCP Business rules, SCP workflow subscription with Docusign License.

      Author's profile photo Kajal .
      Kajal .

      Hello Sudip Ghosh

      I am trying to build an e-separation module. And want to integrate DocuSign with Successfactors at the last step of workflow. Can you please guide me on how can I achieve this? I dont need business rules for that. Just the document generation is needed.