Symptom
- In the National ID portlet, a validation rule continues to display an error message even after bypassing the conditions that trigger it.
- The error message may appear even when attempting to delete the incorrect data.
- This issue is related to changes in the National ID card type and/or Country fields.
- Upon examining the rule trace, the validation rule may show as executed twice.
** 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
- SAP SuccessFactors HCM
Reproducing the Issue
- Configure a validation business rule for the National ID portlet that evaluates the Country and/or National ID card type, as illustrated in the example image below. Assign it to execute onSave for nationalIdCard in BCUI. For additional guidance, please refer to KBA 2092849 - "How to create a Business Rule to validate data on change/save, and provide a Warning or Error message".
- Set up a rule trace to analyze the behavior of the validation rule. For guidance, please refer to KBA 2257064 - "Employee Central - Business Rule Execution Log".
- Navigate to the National ID portlet of sample employees.
- For employees without national ID information populated, the rule from this example works correctly and only allows the addition of the National ID card type/country as specified.
- However, for an employee with a National ID card type/country that needs correction or deletion, attempting to update or delete the record to bypass the validation results in the error message being displayed each time you attempt to save, even with the corrected data already entered.
- Upon reviewing the rule trace, you'll find that in this case, the rule is executed twice for each save attempt.
Cause
- OnSave rules are triggered for all delete, update, and insert actions concerning the national ID.
- Since both the Country and National ID Type are business keys, changing either one will trigger a delete and then an insert action in the backend.
- During the delete action, the rule evaluates the old value, and during the insert action, the rule evaluates the new value.
- This is expected product behavior and will occur for other business keys as well.
Resolution
- To resolve the issue, it is necessary to add conditions to the rule to skip unwanted actions (e.g., delete, update), thereby adjusting the rule to apply only in the intended scenario.
- For the rule in this example, configure it to check if the previous national ID card type is "null". This allows the rule to bypass the Delete and Update scenarios, ensuring that the error message is raised only when an incorrect card type is inserted.
See Also
3593942 - Emergency Contact Information validation business rule triggers twice showing two messages
Keywords
national id information, national id, national id information business rule, national id business rule, national id rule, national id information validation, national id validation, business rule executed twice, country, national id card type, card type, error message, onSave rule, delete, update, insert, null , KBA , LOD-SF-EC-PER-NAT , National ID - Config, Rules, RBP, UI , Problem