SAP Knowledge Base Article - Public

2668688 - National ID Card: How to create custom Regular Expression and Display Format

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

Here you can create a some 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 and Display Format so they 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.

 

Another example might be where you are wanting 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 Country Specifics handbook.

See Also

2526193 - Manage Business Configuration: How to Create or Edit National ID Card formats in BCUI

Keywords

Please enter a valid National identity number, nationalIdCard, reg-ex, display-format, regular expression , KBA , LOD-SF-EC-PER-NAT , National ID - Config, Rules, RBP, UI , How To

Product

SAP SuccessFactors Employee Central all versions