Symptom
- This article describes how to use Business Rules in Recruiting to validate if a field value is only Digits, Letters or Alphanumeric.
- Besides checking the value, you can clear out the value entered and ask the user or the candidate to fill it again until the correct format is entered. These instructions are also provided in this article.
- This rule will only be executed on the UI.
- Notice that the article intends to show the Business Rule feature capability and let the users be more familiar with the tool. The rule described can have different behaviors on different system. Please reach out to your Implementation Team and/or Partner for implement the same if you are having any issues with it.
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 Recruiting Management - All Versions
- Business Rules in Recruiting
Resolution
Rules to validate field value format:
- Candidate Profile and Job Application rules are not supported when Mobile Apply is enabled. Business Rules for Mobile Apply are on road map and will be enhanced on further releases (2866437 & 2781775).
- The same rule structure can be applied to Job Requisition, Candidate Profile, Job Application and Offer Letter. Please, make sure to select the correct template while creating the rule.
- When selecting a template, you will only be able to work within the selected scenario. For example, if you create a Candidate Profile rule and you want to have the same on the Job Application, you must create a Job Application rule as well.
- A validation will make more sense to the user or the candidate if the rule brings a message or a warning after the execution. Please refer to the end of the article on how to create a message in Manage Data. OnSave trigger event does not support raise message function.
Each validation will require a specific regular expression. Please refer to the below expression:
Only digits from 0-9: ^[0-9]+$
Only alphabet letters: ^[a-zA-Z]+$
Only upper/lowercase alphabet letters: ^[A-Z]+$ OR ^[a-z]+$
Only alphanumeric: ^[a-zA-Z0-9]+$
If you want to include space ( ) in the above validations, you need to include a space, a non-breaking space, after the last value, as the following example (Notice the space after the number 9):
Without Space: ^[a-zA-Z0-9]+$
With Space: ^[a-zA-Z0-9 ]+$
To validate any format above with a specific length, you will be using the following expression. You can change the length limit to any number.
Only digits with a length of 1-20: \d{1,20}
Only alphabet letters with a length of 20: [a-zA-Z]\{20\}
Only alphanumeric with a length of 20: [a-zA-Z0-9]\{20\}
Sample Case: Validating a field to receive only alphabet letters and spaces.
Base Object: Candidate Profile
Trigger Event: OnChange
Steps to create the rule:
- Go to Configure Business Rules and click Create New Rule.
- Select Recruiting option and choose Configure Business Rules on Candidate Profile.
- Type the Rule Name and Rule ID.
- You can leave the Start Date as it is.
- Description if desired.
- Click Continue
- On "IF" parameter, set the field which you to do the validation. Then select "Is not equal to" and "Null". This is required to ensure that the rule will not be triggered in case the field is empty.
- Now you need to add another condition. For that, open the dropdown, open Add and select the Parent Add option.
- After adding a new condition, click o the "+".
- On the first dropdown, select Matches() option. On the right side of the box, select "Is Equal To" > "Boolean" > "No".
- String to be Checked: The field where the validation will occur. Same as the first condition.
- Regular Expression: ^[a-zA-Z ]+$
- Above expression will be for entering only alphabetic letters and spaces. You can use any expression provided listed above.
- On "THEN" parameter, set the first option to "Raise Message".
- On "Message" select the message you want to throw it. For more information on how to create message, please refer to the article 2610536 - RCM Business Rules: Raise Message
- You can choose any severity type.
The next steps will instruct you to use the rule to also clear the information from the field if the value entered is invalid. This will force the candidate/user to enter the correct value. It's important to make it clear on the message which are the correct values. In case you don't want to have this scenario, you can move to step 19. - Click on "Add Expression" on the right side of the rule.
- Then on the first option, select "Set" the field where the validation will occur (Same as above steps), select "To be Equal to" and "Null". This will make the rule to turn the field value into "Null" after the message is raised, therefore every time a wrong value is entered, the field will be automatically cleared.
- Save the rule.
- You will be able to modify it anytime.
- Go to Manage Rules in Recruiting.
- On Candidate section, on Field Change Rules (onChange event type), select the field and the rule.
- Save the changes.
See Also
2610536 - RCM Business Rules: Raise Message
2866437 - Business Rules on Job Application are not triggering - Recruiting Management
2781775 - Business rules are not getting triggered for Candidate Profile - Recruiting Management
2618607 - Manage Rules in Recruiting Management
2704222 - Business Rules Are Not Being Saved - Recruiting Management
2919193 - How to use Business Rules to Validade Candidate Age - Recruiting Management
Keywords
Business Rules; Rule; Recruiting; RCM; Validation; Regular Expression; Only Letters; Check; Field; Value; , KBA , LOD-SF-RCM-RUL , Recruiting Rule Issues with MDF Platform , How To
Product
Attachments
Pasted image.png |