SAP Knowledge Base Article - Public

2951856 - How to raise a validation message on relationship-type based on the Employee's Marital Status?

Symptom

How to validate when an employee is not married and the relationship-type is Spouse which shouldn't be valid?

The validation rule works on MSS/Take Action but not in Add New Employee

Environment

  • SAP SuccessFactors Employee Central - Dependents Management
  • SAP SuccessFactors Employee Central - Personal Information
  • SAP SuccessFactors Employee Central - Hire/Rehire 

Reproducing the Issue

  1. Configure an onChange rule to validate the relationship-type using Base Object Dependents:

    IF Dependents.ParentBiographical Information.Personal Information.Marital Status is not equal to Married
    AND Dependents.Relationship is equal to Spouse

    THEN Raise Message " SpouseValidation " with Error severity
    You cannot select Spouse if Employee is not Married. Please choose the valid Relationship Type.

  2. Go to an Employee who is not Married and add a Dependent with relationship-type Spouse.
  3. The error is raised as expected.
  4. Go to Add New Employee Wizard and hire an Employee whose Marital Status is not Married.
  5. Add a Dependent with relationship-type Spouse.
  6. The error does not appear.

Cause

The rule using Dependents Base Object does not work in Add New Employee because the rule has Dependents.ParentBiographical Information.Personal Information.Marital Status is not equal to Married in the IF Statement. This statement tries to access the Dependents Parent Object before even the Employee is created in the system. Hence, the system pulls a null value and the rule is not satisfied.

Resolution

There are two different rules to be configured for this validation to work both on Add New Employee and ESS/MSS/History Page. In addition to the rule using Dependents Base Object, another rule using Employee Information has to be configured and set as onChange in the relationship-type field.

IF Employee Information.Personal Information.Marital Status is not equal to Married
AND Employee Information.Person Relationship.Relationship is equal to Spouse

THEN Raise Message " SpouseValidation " with Error severity
You cannot select Spouse if Employee is not Married. Please choose the valid Relationship Type.

Keywords

dependents, validation, married, relationship-type, add new employee, personal information, marital status , KBA , LOD-SF-EC-HIR , Hire & Rehire Wizards , LOD-SF-EC-PER , Person Data (All Person Data Types) , LOD-SF-EC-DPD , Dependents Management , How To

Product

SAP SuccessFactors Employee Central all versions