Symptom
- How to create a custom Regular Expression and Display Format for a Country?
- How to create a custom Regular Expresison and Display Format for a Country that is not available on Employee Central Master Data Models?
- When entering a National ID getting error "Please enter a valid National identity number".
Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.
Environment
- SAP SuccessFactors HXM Suite
- SAP SuccessFactors Employee Central
Resolution
National ID Card (nationalIdCard) configuration can be maintained via Admin Center > Manage Business Configuration (please refer to article 2526193 for further guidance).
In this article, we'll provide guidance on how you can create a simple validation to ensure when the ID number is entered into the system, it is entered in the correct format.
To be able to setup the Regular Expression (regex) and Display Format to work, you will need to ensure they are configured the same.
GENERAL NOTE: You must include any spaces, hyphens and other symbols that are used in the Display Format, in the Regular Expression.
For example, the following Regular Expression and Display Format are not configured correctly:
-
Display Format = N NNNN NNNN NN
- Regular Expression = [\d]{11}
The reason the above is not correct, is because in the Display Format you have specified spaces in between each set of numbers. Therefore the Regular Expression must also be setup the same way, with spaces and to check each set of digits between each space. For exampe, the correct format based on the above requirement is -:
-
Display Format = N NNNN NNNN NN
- Regular Expression = [\d]{1} [\d]{4} [\d]{4} [\d]{2}
Notice that each number group from the Display Format is checked individually, and the spaces between the numbers in the Display Format are also included in the Regular Expression.
Here is another example where you want to use a hyphen to separate the digits. The same logic applies as per above. Example of a correct config using hyphens in the Display Format is:
-
Display Format = N-NNNN-NNNN
- Regular Expression = [\d]{1}-[\d]{4}-[\d]{4}
The same logic must be applied to Countries that are currently not available on the Employee Central Master Data Models:
*This is just an example of custom Regular Expression and Display Format created for a country that is not available on the Data Models.
For further information regarding the configuration of pre-delivered National ID formats, please refer to the following guide Country/Region-Specifics for Employee Central. Each pre-delivered country's National ID card names, display format and other details can be found in Identity section of that country in this guide. You can find more about the validation algorithm of a country's National ID card's value under Appendix > Breakdown of National ID Validation Rules section of the guide.
Note: Custom National IDs do not have any pre-delivered/standard validation. These are validated only against the Display Format and Regular Expression.
You'll find more details about National ID validation and configuration in the following KBA: 2093378 - National ID validation issues - Employee Central.
See Also
2526193 - Manage Business Configuration: How to Create or Edit National ID Card formats in BCUI
2093378 - National ID validation issues - Employee Central
2923091 - Error: National ID XYZ already exists for country/region ABC and card type MNP
Keywords
Please enter a valid National identity number, nationalIdCard, reg-ex, display format, regular expression, validation, algorithm, error, warning, BCUI, CSF, regex, identity, additional, extra , KBA , LOD-SF-EC-PER-NAT , National ID - Config, Rules, RBP, UI , LOD-SF-EC-PER , Person Data (All Person Data Types) , How To