SAP Knowledge Base Article - Public

2355576 - How do I generate Employee Id automatically for user creation via the API

Symptom

Creation of a new user via Successfactors UI automatically generates an employee Id for that user.

But how to achieve the same automatic generation of employee id when creating new users via the API?

Environment

Successfactors

Resolution

You can achieve the same functionality via APIs but you need to execute one additional API call to achieve the same functionality.

The userId is not automatically generated via the 'User API Upsert' operation but you can call another API(generateNextPersonID) as follows-

https://apiX.successfactors.com/odata/v2/generateNextPersonID?$format=json

This will return you the 'PersonId' which is nothing but the automatically generated userId, exactly same as how the 'Add New Employee' feature generates when employee is created via UI.

And this Id can be passed in the subsequent API request for different entities as follows-

User Entity:               In the fields username and userID
PerPerson Entity:     In the field personIdExternal
Employment Entity: In the fields personIdExternal and userID
Per* Entities:           Used in all Per* entities for the field personIdExternal
Emp*Entities:           Used in all Emp* entities for the field userId

Keywords

personIdExternal, employee Id, generateNextPersonID , KBA , LOD-SF-INT-API , SF API & Adhoc API Framework , LOD-SF-INT , SF Integrations - EC Payroll, Boomi/ HCI, API , How To

Product

SAP SuccessFactors HCM Core all versions