SAP Knowledge Base Article - Public

2685847 - How to Create a Business Rule to Format a Name Field

Symptom

How to create a business rule to format a name field in order to have always first letter in uppercase.

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 Employee Central
  • Business Rules

Resolution

  1. Navigate to ‘Configure Business Rules’ in Admin Center.
  2. Create a new business rule with Base Object ‘Personal Information’
  3. Populate the business rule as follows:
    rule_edit_mode.jpg

    - The Then condition firsts uses the ‘Format()’ function to format the string using the template. The template is defined as %s%s. This is two stirng values). (%s = a string.)

    - For the first string (%s), we want to define the uppercase letter.
      The Then condition makes use to the 'ToUppercase()' function to do this. We must define which value we want to be uppercase, so we use the ‘Substring()’ function, to define the first letter in the string from the template.
      We set the ‘First Name' as the string that we are taking the substring from.
      We want to take only the first letter, so we start on index 1 of the string with a length of 1.

    -The Then condition then makes use of the ‘Substring()’ function, to define the end of the string (%s) from the template. We set the ‘First Name' as the string that we are taking the substring from.
      We then start the substring at index 2. The length is optional and should be left ‘Null’ as there may be different length names.

      (The index of a string is the position of a character in the string. Strings start at index 1.)

    - Saved Rule:
    rule_saved.jpg  
  4. Trigger it as ‘onChange’ on the relevant name field, in this case first name field in the ‘personalInfo’ element.

Note:
If you are using this Rule format to capitalise a field value that has multiple words, such as a Position Title or Address, please note this rule will only capitalise the first letter of the field, it isn't possible to set a rule which will capitalise the first letter of every word of the value entered. This is because the field value will be recognised as a single string value, and the 'ToUppercase()' function only takes into account the full string, it cannot identify single words within the string. There is currently no business rule function which can identify and separate a string value in this way.

See Also

2297965 - How to Create a Business Rule to Format a Phone Number

2426526 - How to use a Business Rule to apply a Format/Regular Expression to a Field

Keywords

format, uppercase, string, name, rule, Regular Expression, reg-ex, Matches(), Format(), Matches, String to be checked, ToUppercase , KBA , LOD-SF-EC-PER-PRS , Personal Info - Config, Rules, RBP, UI , How To

Product

SAP SuccessFactors Employee Central all versions