Today I want to share one of my findings about the Employee Central Rule structure. The case is simple when you have a customer who asks for automatic formatting when users entered a custom text with multiple words into a string field. The field could be the first name field and the format wished is to have the first letter of each input be upper and the rest of the word be lowercase.
Normal rule functions like substring etc. do not support this case so I came up today with a stable and well-functioning resolution to this case. The main struggle here is to detect the space between words so I used the index of() function to do so.
For those who are not familiar with the index of(), it's a function that counts the characters till it finds the one you wish. In this case, it would be space but since it's not a character in the usual input language we have to find a relevant as a regular expression which is \s, and convert it to a character which we can see in our function.
I hope the explanation is clear but even that so I think we need to see it in rule structure as follows:
Finding the first space entered
Now we have the number to use in Substring() function to format as asked. After this achievement formatting of a 2 text entered on a string field rule function would be:
Then part of formatting 2 words
The thing here to consider is the index of() function counts space also so you should use the minus() function for better performance.
-Make sure the end-user puts only the alphabetical characters. Validate this as the fist if of your rule:
Alphabetical Input Check Condition
-End users may enter extra words which wouldn't be in your scoping like your rule was scoped to format 2 words but users may put 3 words. This kind of case should be validated at the end of the rule with Else condition:
Warning For Unscoped Entry
Thanks to the Index of() function we are able to detect the position of the space to use it under the substring function. This allows us to modify the multiple-word entries.
Last but not least, I would appreciate it if you could provide your feedback, and if you have any questions feel free to meet me in the comments. I have just started to share my knowledge on SuccessFactors if you want to hear more follow my profile!