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.