In this Blog, I would like to talk about Integration of SuccessFactors Intelligent Services with Third Party applications like Java applications built on HCP.
We have seen so many cases where a customer would like to extend SuccessFactors functionality using apps built in SAP Cloud Platform. I will provide a similar example where we would be using events from intelligent services to achieve the same.
Common examples which we can think of:
- Upon Hire event, you would like to send an SMS to the new hire that he has been hired in the system and his details are created
- Upon Hire event, you would like to send the new hire details to a third party system which could create order to send Goodies/Chocolates to new hire automatically
- Upon termination event, you would like to notify the System which triggers exit formalities for the employee
Basically, with this approach, you can consume any Intelligent Services event and build your custom logic in third party application.
In my example below, I would be showcasing Scenario 1) of sending an SMS to new hire on Hire event.
To simply the process, I would break this prototype example into five steps
- Creating Java Application in Eclipse with required rest API
- Deploying the Java Application in SAP Cloud Platform
- Creating Integration in Integration center to call the rest API.
- Link the Integration Definition to ISC (Intelligent Services Center)
- Testing the new Hire event and custom application
1. Building the Java Rest API to be called by Intelligent services
I recommend to use the Eclipse IDE (neon) since neon already has ability to connect to SAP cloud Integration services and servers.
Create a new Maven Web Project with structure similar to below.
You will have to create two packages. Package com.sfevent has an USER object. (you can name it as you want)
The user object is nothing but a representation of JSON object which is being sent across in a Payload of Intelligent Services event.
Package com.sfevent.rest has a class which represents the REST API to be called by SF Intelligent services.
Web.xml contains the web service description and pom.xml contains all the Maven Dependencies (libraries) which are required for this application
You can find the sample project code attached here Project
User Class:
The User object will have three attributes which you receive from Successfactors Intelligent Services event: userID, name, phone
JSONService class:
The service class has the actual rest API logic to consume the intelligent services event payload and then trigger a SMS to new hire.
Please note: I am using MSG91 SMS Provider API to send SMS. You can use any SMS provider API in general
2. Deploying the Java Application in SAP Cloud Platform
Once the Java project is completed , you would need to deploy this project into your SAP cloud platform account.
You can find various blogs or videos in Google on how to deploy a java application in HCP.
However I am reiterating the steps I followed here:
The below link would help you to configure SAP cloud platform tools in eclipse
https://www.sap.com/india/developer/tutorials/hcp-java-eclipse-setup.html
Go to Eclipse -> windows -> preferences -> Sever
Choose SAP Cloud Platform and provide the credentials and URL
Next right click on your project-> Run As -> Run on Server
Click on Manually Create new server and choose server as SAP-> SAP Cloud Platform. Click on Finish
Once the application is deployed in cloud platform, you should see the server as started
Now Go to your SAP cloud platform account and then to you subaccount - > Java applications
You should see the application as started. You will also find the end point URL here. Note this URL down .
This is nothing but the REST API endpoint URL which is called by Integration center upon the new hire IS event in SuccessFactors
3. Creating Integration in Integration center to call the rest API and link it to ISC (Intelligent Services Center)
The next step of the Implementation is to create an Integration via integration center
Go to Admin Center -> Integration Center -> My Integrations and click on create new and more Integration types
Select the type as Intelligent Services , Destination as REST and format as JSON as shown below
Select the event as New Hire in search entity page. The new hire event uses Job Information as the Base Entity.
In configure Fields View select the fields you want to send across to your java application in JSON Format.
Create three fields userID , name and phone. Map them to relevant Job Information fields using the mapping view.
After mapping is done , you should have something like the this:
In the response Tab, upload a dummy JSON File with the above fields
In Destination settings, You would need to maintain the rest API details
The End Point URL is constructed as below
<<HCP_APP_URL>> /rest/json/metallica/post
The HCP APP URL can be fetched from your HCP account when you deployed the java application (please see section 2 )
The path /rest/json/metallica/post is the path of the rest API. /json/metallica is path to Rest API Class JSONService and /post is path to method to send SMS
Save the Integration. You are done with setting up Integration Center definition
4. Deploy the Integration in Intelligent Services Editor
This is the final step of the prototype.
Go to Business Configuration and attach the standard Intelligent Services Hire event Rule (EVENT_HIRE) since this is the publishing event rule
Go to Intelligent services editor (ISC) and select new hire event.
Create a new Flow and new flow rule as Shown below
Click on Integration Tab of Flow and Add the integration you just created from Integration Center
After adding integration, you should see the below
Click on Actions on Top and save the flow. You should see a message that your flow is published
5. Testing
Go To Add new employee and Hire an employee with effective start date as To Example : Jan 11
th 2017 )
Jack ISC is the employee Hired in my demo with ID as 1922 and Mobile Number as “+919XXXXXXXXXX” (in contact details of hire step)
Monitoring of the event in Intelligent Services Editor :
Logs from Integration Center :
Message in Java Class (Rest API)
SMS received by new hire on his Mobile number