SAP SuccessFactors Connector 3.2 | MuleSoft Documentation
# SAP SuccessFactors Connector 3.2
Anypoint Connector for SAP SuccessFactors (SuccessFactors Connector) provides full support to query, create, update, and delete entities using the OData API exposed by SuccessFactors.
This connector enables operations to:
  * Create, update, and delete entities
  * Retrieve a single entity or query multiple entities


For software requirements and compatibility, see the SAP SuccessFactors Connector Release Notes.
## Before You Begin
To use this connector, you must be familiar with:
  * SAP SuccessFactors
  * Mule runtime engine (Mule)
  * Anypoint Connectors
  * Anypoint Studio essentials


To use this connector you must have the following:
  * A developer account or other valid SAP SuccessFactors instance
  * A MuleSoft Enterprise license


## Supported Operations
SuccessFactors Connector supports the following outbound operations:
  * Create Entity
  * Delete Entity
  * Get Entity by ID
  * Query
  * Update
  * Update Entity
  * Upsert Entity


## Add the Connector to a Studio Project
Anypoint Studio provides two ways to add the connector to your Studio project: from the Exchange button in the Studio taskbar or from the Mule Palette view.
### Add the Connector Using Exchange
  1. In Studio, create a Mule project.
  2. Click the Exchange icon **(X)** in the upper-left of the Studio task bar.
  3. In Exchange, click **Login** and supply your Anypoint Platform username and password.
  4. In Exchange, search for `success`.
  5. Select the connector and click **Add to project**.
  6. Follow the prompts to install the connector.


### Add the Connector in Studio
  1. In Studio, create a Mule project.
  2. In the Mule Palette view, click **(X) Search in Exchange**.
  3. In **Add Modules to Project** , type `success` in the search field.
  4. Click this connector’s name in **Available modules**.
  5. Click **Add**.
  6. Click **Finish**.


## Configure the SuccessFactors Connector Global Element
To use SuccessFactors Connector in a Mule application, configure a global SuccessFactors configuration element that can be used by as many SuccessFactors Connector instances as required for your application:
  1. Click the **Global Elements** tab at the base of the canvas.
  2. In the Global Configuration Elements screen, click **Create** to open the **Choose Global Type** window:
  3. In the **Choose Global Type** window:
    1. Expand **Connector Configuration**.
    2. Select **SuccessFactors Connector Config**.
    3. Click **OK**.
The following configuration dialog window for Basic Connection appears.
  4. Configure these properties:
Parameter | Description  
---|---  
CompanyID | Your company ID  
User Name | User name to connect  
Password | Password to connect  
Data Center’s Endpoint URL | SuccessFactors Web API URL  
Enable Session Reuse | The session is alive.  
Notes:
     * In the previous Basic configuration screen, the placeholder values refer to a configuration file `mule-artifact.properties` in the `src/main/resources` folder of your project.
     * You can either enter your credentials into the global configuration properties, or reference a configuration file that contains these values.
     * For simpler maintenance and better reusability of your project, it’s best to use a configuration file. Keeping these values in a separate file is useful if you need to deploy to different environments, where your access credentials differ.
  5. Click **OK** to save the global connector configurations.


## Use Case: Set Up and Run in Studio
  1. In Anypoint Studio, click **File > New > Mule Project**.
  2. Specify a Project Name and click **Finish**.
  3. Search for `http` and drag the HTTP connector to the canvas.
  4. Click the green plus sign next to Connector Configuration, and click **OK** in the menu to accept the default values.
  5. Drag the SuccessFactors connector operation to the canvas.
  6. Click the green plus next to Connector Configuration, and specify your access credentials.
  7. Click a connection strategy for authentication.
  8. Configure these properties:


Parameter | Description  
---|---  
CompanyID | Your company ID  
User Name | User name to connect  
Password | Password to connect  
Data Center’s Endpoint URL | SuccessFactors Web API URL  
Enable Session Reuse | The session is alive.  
+ . Click **OK**.
## To Run a Flow
  1. In Package Explorer, right click your project’s name, and click **Run As > Mule Application**.
  2. Check the console to see when the application starts. You should see messages such as these if no errors occur:


```
************************************************************
INFO 2019-07-14 22:12:42,003 [main] org.mule.module.launcher.DeploymentDirectoryWatcher:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Mule is up and kicking (every 5000ms)          +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO 2019-07-14 22:12:42,006 [main] org.mule.module.launcher.StartupSummaryDeploymentListener:
**********************************************************
* - - + DOMAIN + - -        * - - + STATUS + - - *
**********************************************************
* default              * DEPLOYED      *
**********************************************************
************************************************************************
* - - + APPLICATION + - -  * - - + DOMAIN + - - * - - + STATUS + - - *
************************************************************************
* myapp           * default       * DEPLOYED      *
************************************************************************
```

## Example: Success Factors
This example demonstrates the use of SuccessFactors Connector.
To build and run this demo project, you need:
  * Anypoint Studio with Mule 4.1.1 or later
  * SuccessFactors Connector v3.0.0 or later
  * SuccessFactors credentials to send OData API requests


### To Test the Flow
  1. In Anypoint Studio, in the **File** menu, import the demo project into your workspace.
  2. Specify your basic credentials in the `/src/main/app/mule-app.properties` file.
  3. Run the project in Studio.
  4. Type `localhost:8081` in your browser to access the selection menu of the demo.
  5. Optionally, you can configure the following parameters:
     * **Connection Timeout** Timeout for the initial connection with the server **Read Timeout** Timeout for waiting to read data from the server
## Example: Success Factors
This example demonstrates the use of SuccessFactors Connector.
To build and run this demo project, you need:
  * Anypoint Studio with Mule 4.1.1 or later
  * SuccessFactors Connector v3.0.0 or later
  * SuccessFactors credentials to send OData API requests


### To Test the Flow
  1. In Anypoint Studio, in the **File** menu, import the demo project into your workspace.
  2. Specify your basic credentials in the `/src/main/app/mule-app.properties` file.
  3. Run the project in Studio.
  4. Type `localhost:8081` in your browser to access the selection menu of the demo.
  5. Optionally, you can configure the following parameters:
     * **Connection Timeout** Timeout for the initial connection with the server **Read Timeout** Timeout for waiting to read data from the server


You can use the selection menu from `http://localhost:8081` to test the flows.
## Use Case: Success Factors Operations
```
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:successfactors="http://www.mulesoft.org/schema/mule/successfactors"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/ee/core
http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/successfactors
http://www.mulesoft.org/schema/mule/successfactors/current/mule-successfactors.xsd">
 <http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" >
   <http:listener-connection host="0.0.0.0" port="8081" />
 </http:listener-config>
 <successfactors:config name="SuccessFactors_Configuration" doc:name="SuccessFactors Configuration" >
   <successfactors:basic-connection
       companyId="${config.companyId}"
       userName="${config.userName}"
       password="${config.password}"
       endpointUrl="${config.endpointUrl}"/>
   </successfactors:config>
   <configuration-properties file="automation-credentials.properties"/>
   <flow name="Query">
      <http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="/list"/>
      <successfactors:query entitySetName="VendorInfo" doc:name="Query"
	  config-ref="SuccessFactors_Configuration" />
      <ee:transform doc:name="Transform Message">
        <ee:message >
          <ee:set-payload ><![CDATA[%dw 2.0
  output application/json
  ---
  payload]]></ee:set-payload>
        </ee:message>
      </ee:transform>
      <logger level="INFO" doc:name="Logger" message="#[payload]"/>
    </flow>
      <flow name="Create-Entry">
      <http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="/createVendor"/>
      <ee:transform doc:name="Transform Message">
        <ee:message >
          <ee:set-payload ><![CDATA[%dw 2.0
  output application/java
  ---
  {
    vendorCode: "XYZ123ABC",
    effectiveStartDate: "2018-07-08T00:00:00" as DateTime,
    effectiveStatus: "I"
  }]]></ee:set-payload>
        </ee:message>
      </ee:transform>
      <successfactors:create-entity doc:name="Create entity"
	  config-ref="SuccessFactors_Configuration" entitySetName="VendorInfo"/>
      <ee:transform doc:name="Transform Message" >
        <ee:message >
          <ee:set-payload ><![CDATA[%dw 2.0
  output application/json
  ---
  payload]]></ee:set-payload>
        </ee:message>
      </ee:transform>
      <logger level="INFO" doc:name="Logger" message="#[payload]"/>
    </flow>
      <flow name="Get-Entity-by-Id">
      <http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="/getById"/>
      <ee:transform doc:name="Transform Message">
        <ee:message>
          <ee:set-payload><![CDATA[%dw 2.0
  output application/java
  ---
  {
  	effectiveStartDate: attributes.queryParams.effectiveStartDate as DateTime,
  	vendorCode: attributes.queryParams.vendorCode
  }]]></ee:set-payload>
        </ee:message>
      </ee:transform>
  		<successfactors:get-entity-by-id entitySetName="VendorInfo" doc:name="Get entity by id"
		config-ref="SuccessFactors_Configuration" />
      <ee:transform doc:name="Transform Message">
        <ee:message >
          <ee:set-payload ><![CDATA[%dw 2.0
  output application/json
  ---
  payload]]></ee:set-payload>
        </ee:message>
      </ee:transform>
      <logger level="INFO" doc:name="Logger" message="#[payload]"/>
    </flow>
    <flow name="Delete-Entry">
      <http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="/deleteVendor"/>
      <ee:transform doc:name="Transform Message">
        <ee:message >
          <ee:set-payload ><![CDATA[%dw 2.0
  output application/java
  ---
  {
    effectiveStartDate: attributes.queryParams.effectiveStartDate as DateTime,
    vendorCode: attributes.queryParams.vendorCode as String
  }]]></ee:set-payload>
        </ee:message>
      </ee:transform>
      <successfactors:delete-entity entitySetName="VendorInfo" doc:name="Delete entity"
	  config-ref="SuccessFactors_Configuration" />
      <ee:transform doc:name="Transform Message">
        <ee:message >
          <ee:set-payload ><![CDATA[%dw 2.0
  output application/json
  ---
  payload]]></ee:set-payload>
        </ee:message>
      </ee:transform>
      <logger level="INFO" doc:name="Logger" message="#[payload]"/>
    </flow>
</mule>
```

## Use a Query as a Filter
  1. In the Anypoint Studio’s **Filter** field, select the **Query** value, which enables you to create your own filter.
  2. In the **Value** field, enter the filter options using the format described in the ODATA URI Conventions site, item 4.5. You don’t need to add the **Entity set name** in the query; you have to select it from the list.


Examples:
  * `startswith(username, 'Mule') eq true`
  * `startswith(username, 'JA') eq true or endswith(username, 'n3') eq true`
  * `username eq 'Mike'`


The Query value is only used for the **Filter** field; the connector builds the actual query.
## See Also
  * Introduction to Anypoint Connectors
  * Use Exchange to Discover Connectors, Templates, and Examples
  * SuccessFactors Connector on Exchange
  * SuccessFactors HCM Suite site
  * MuleSoft Help Center