Employee central: Automatic User ID generation
This article has successor: https://blogs.sap.com/2018/09/23/employee-central-automatic-user-id-generation-post-1808/
When implementing Employee Central you can see some tough questions and it is good to prepare some answers. One of them is automatic generation of UserID. This UserID is used in whole system and all employee data are relevant to this ID. In data model it is called person-id-external and it is used for employee data import and many more. The typical question is how to populate the UserID automatically to cover our business processes.
We will go through several options today. The first option is to create UserID manually according to rules that you have. These rules can be so complex that you cannot cover them by EC rules configuration. This offer the biggest flexibility that you can use everything you want. You can combine names, numbers and special characters. This is the least recommended solution.
Let’s move to different which is number two. This uses sequence, format template and business rule to create the UserID. The first is sequence configuration that can be done in Manage Data (or better in Admin tools – Employee files – Manage Sequence).
Create new sequence that will have start 0, step 1 (or if you want some gaps, enter different number). This sequence will be used in the business rules. The rule should looks like this:
Important are following fields:
BaseObject – recommend to select Biographical Information or Employee Information
IF condition – this means when the field is empty, the rules will be executed.
Template: E%05d – starting with “E” and then five zeros but the sequence will update the five zeros to 00001 for the first employee. So the result will be E00001. And with each new hire the number will be incremented.
Finally you need to assign the rule to the data model.
As onInit trigger rule the User ID will be populated when you enter the add new employee page. The onInit has some negative impact if you do not finish the process of adding employee completely. There can be gap in the employee IDs sequence so better is to use onSave business rule.
Now the third a maybe the best possible solution. This is the question whether the solution is the best. You will get more facts about it at the end. In this case we will focus on different usage and creating User ID from the name of the new employee. The next rule takes first letter from first name, first letter from middle name and complete last name and use it as UserID.
See that there is different base object used (it is necessary to access the employee name and user ID together). Rest is simple and the result looks amazing
It is set to business model as onChange action on Last Name. So when you update the last name then the User ID is populated. With the IF condition equals to null you cannot then change last name again and expect the update of User ID.
Now the advantages and disadvantages of described solutions:
- Variant 1 – you can have anything you want
- Variant 2 – simple to configure and very useful for large organizations, can be used by different legal entities in different way
- Variant 3 – many objects in EC are stored with User ID information so it is simpler to find some employee data by the name than the number
- Variant 4 – (provided by Vasiliy Baranovskiy) Autogenerate UserID and Person Id (in general, these are different identifiers) via standard logic. Set Company System Setting – Next Person Id Assigned and make personInfo.person-id-external visibility to View.
- Variant 1 – nothing preset, so it can be hard to use the same convention for all employees
- Variant 2 – can be hard to find some data relevant to the employee (you see only generated ID)
- Variant 3 – some duplicates can be found during adding new employee and it is not easy to manage the rules after.
- Variant 4 – no custom requirements available
Do you have any other experience or idea how to set the User ID? Let all know in the comments.
Very useful blog, Thanks for sharing.
Following blog is also interesting as how mail id is being auto generated.
Employee Central | Business Rules Engine at work
Good blog. I wonder how you would secure unique person id, which to my account, is a very likely scenario ?
Very good blog.
I have the same question. How are collision scenarios handled when the username is generated using the names of the employees.
there is no option to handle these. The userids are generated and only in case there is duplicate value the system will raise a message that there is another entry with same id. We haven't found solution to validate whether the userid already exists or not.
Images are not available.
Can SSFF generate the user e-mail, as well?
sure, there is no reason why not. In that scenario the e-mail needs to defined by HR and not by IT as this is in the most companies.
Good one thanks - you rock
this is helpfull information, however can ranges be pre-defined to skip each other for employee id’s? For example, set an initial range from 1-10, then, once it hit’s 10, have the sequence skip to 90-100.
It is to avoid conflicting with pensioner’s id.
When Iam trying to upload the Basic Import and Iam keeping the User ID as blank. Employees are not created in Successfactor. But when Iam giving the User ID in the csv for the Basic import its creating the employee.
Please tell me what shall I do to create the User Id automatically when Iam doing Import Employee data-> Basic import.
you can't utilize id automatic creation when importing. You need to provide user ids. So do it manually outside the system and change the sequence numbers.
It is possible to generate User ID from system through API call?
When i am calling User of SFSF then userid is mandatory it means i need to pass external ID. Is it possible to get it from system before making API call?
It is possible to use the API generateNextPersonID and use the same value in your User ID.
Thanks for this article. I do have one question though.
Is it possible to set a Person ID sequence (i.e. 01000000 to 01999999) and, at the same time, enable the “Enable Database Sequence” option to generate the next Employee ID and avoid getting duplicate values when using the getNextPersonID API?
I got the “Enable Database Sequence” information from the KB below.