SAP Knowledge Base Article - Public

2355576 - How do to generate Employee ID automatically for user creation via the OData API

Symptom

Creation of a new user via Successfactors UI automatically generates an employee Id for that user. How to achieve the same automatic generation of employee id when creating new users via the API?

Environment

SAP SuccessFactors HCM Suite

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.
  • 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

Note: When you generate more than one ID, use a $BATCH statement to avoid too many roundtrips. Make sure that users use the generated IDs in a unique way. Any unused numbers will create gaps since the API generates the numbers in an incremental fashion. More information at the OData API EC Reference Guide.

See Also

2854509 - generateNextPersonID function not available in CPI

2610558 - How to use the function import generateNextPersonID in Boomi

2418814 - How to configure an MDF Sequence object and Business Rule to auto-generate Person ID during Hire

2493579 - Employee Central: Person/User IDs Used Within Employee Central - SuccessFactors Employee Profile

Keywords

Automatic generation of person ID using generateNextPersonID , KBA , LOD-SF-INT-ODATA , OData API Framework , LOD-SF-INT , Integrations , How To

Product

SAP SuccessFactors HXM Suite all versions