The CreatorCon Call for Content is officially open! Get started here.

Apurva16
ServiceNow Employee
ServiceNow Employee

Introduction:

The SuccessFactors spoke is an invaluable tool for integrating SAP SuccessFactors with ServiceNow. It allows you to seamlessly import organizational structure data and employee information into your HR Profile and job history table. However, it's essential to be aware of a particular limitation when dealing with the Compound Employee API from SAP.

 

The Challenge:

The Compound Employee API has its limitations, notably when attempting to retrieve more than 20,000 employee records in a single integration process run. This limitation can become a roadblock, particularly for large organizations. In my experience, the process may abruptly halt around the 25,000-employee mark, potentially disrupting crucial operations.

 

Apurva16_0-1694161563840.png

 

The Solution:

To overcome this challenge, you need to strategize your integration process effectively. The key is to break down the process into smaller, manageable runs, each fetching less than 20,000 records. This division can be based on various factors, such as company, department, or division, depending on your organizational structure.

 

Choosing the Right Parameter:

Before implementing the solution, carefully analyze your employee data to determine the best parameter for division. Not all fields are supported in the "Where Clause." Choose from fields like Company, Employee Class, Department, Division, Business Unit, Location, Job Code, or Pay Group. Always check the SAP manual for the up-to-date list.

 

Implementing the Solution:

Once you've identified the suitable parameter, you can begin implementing the solution. The strategy involves running a record-fetching loop, where the process iterates while fetching records for a specific organizational structure. For example, if division proves to be the ideal parameter, you'd run the job for fetching employee data while limiting it to one division at a time.

 

Below are the changes that you will need to make in the spoke:

 

SOAP Message:

 

If you look at the SOAP message, you'll notice that it tries to fetch all the users from SuccessFactors. In order to limit it to 1 department at a time, you need to add the department in the where clause.

 

You can add " division = '${division}'" in the where clause of the SOAP message for the Worker profile and job history SOAP messages.

 

 

 

 

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sfobject.sfapi.successfactors.com">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:query>
          <urn:queryString>SELECT person, employment_information, job_information
			  from CompoundEmployee
			  where 
			  division = '${division}'
			  and selectFromDate = to_date('${current_date}','YYYY-MM-DD')
			 
			ORDER BY
			 start_date
	    </urn:queryString>
		<urn:param>
			<urn:name>maxRows</urn:name>
			<urn:value>800</urn:value>
	    </urn:param>
      </urn:query>
   </soapenv:Body>
</soapenv:Envelope>

 

 

 

 

The '${division}' value will be set in the subflow and action.

 

Action:

 

  1. Go to your worker profile and job history actions (eg. SF Retrieve Worker Profiles).
  2. Add an input in the action for the division. You'll get this division data from the subflow that calls the action.
  3. Add an input in the Script step of the action for the division and get the value from the action input.
  4. Since this is now part of the inputs it will be sent to the utility "SuccessFactorsUtil".

Utility:

Make the following changes to the "SuccessFactorsUtil"

 

Inside the function "getUpdatedQueryDates: function(inputsJSON) {" add the variable for division as "

var division = inputsJSON.division;"
Replace the line "envelope = givenEnvelope.replaceAll('${current_date}', todayDate).replaceAll('${last_modified_date}', inputsJSON.current_date);" with "envelope = givenEnvelope.replaceAll('${current_date}', todayDate).replaceAll('${last_modified_date}', inputsJSON.last_run_date).replaceAll('${division}', division);"
 
The above will pass the value of the division to the SOAP message.
 

Subflow:

Go to your Worker profile and job history sub-flows (eg. Retrieve Worker Profiles).

 

Look up the active divisions and run the action in a for loop for each of the divisions. Pass the value of the division to the action along with the other inputs.

 

Apurva16_0-1694172846525.png

This will run a new process for each division and allow you to fetch the employee records per division.

 

Please note that there is a known problem with the effective date and using parameters in the where clause. This is explained in the SAP manual and you can see a snapshot below. This could at times lead to getting a few extra records from job history. Please ensure to have checks in your transformation table to only process the top records.

 

Apurva16_0-1694177515419.png

 

I hope this article helps you with getting more out of the spoke and overcoming the limitations.

Comments
Sid Ali Moumene
ServiceNow Employee
ServiceNow Employee

Great article on SuccessFactor and ServiceNow integration, this is very helpful, thanks a lot!

Joe0109
Tera Explorer

Great article 

Prijith Vijayan
ServiceNow Employee
ServiceNow Employee

Great article AJ, thanks a lot for sharing

Manan Bhatt
Tera Contributor

Amazing article, Apurva! 

 

I was curious on what your take is on updating the SuccessFactorsUtil Script Include. By default it is read only. Have you seen an issue making changes to it in your run of using the integration? Also curious to see if there are any other actions/subflows that need to be modified with the changes you have indicated or it just the ones for worker profile? Awaiting your reply. Thanks.

Apurva16
ServiceNow Employee
ServiceNow Employee

@Manan Bhatt ,
you will need to clone the Util and refer that util to be called in your actions and subflows.
on the second point, it depends on what data you are trying to fetch, you might have to make the same changes on the job history subflow too.

Joan Marisse Pa
Tera Explorer

Hello,
How come we don't see those OOB Actions in the flow designer; thus we cannot edit it.

Hope you can assist us on how are we able to access it.

 

Thank you!

Version history
Last update:
‎09-08-2023 06:18 AM
Updated by:
Contributors