Skip to main content
Administrator Guide
Last Updated: 2024-11-01
Example: Custom Validations to Prevent Multiple Spouses

Example: Custom Validations to Prevent Multiple Spouses

This example demonstrates how to create a custom validation to prevent a worker from enrolling more than one spouse or domestic partner in a benefit plan. We create 2 calculated fields, create the validation rule, and then add the validation message to the related actions of the validation.
Security:
Set Up: Custom Validations
security domain in the System functional area.
  1. Create the first calculated field.
    1. Access the
      Create Calculated Field
      task and enter these values:
      • Field Name
        :
        Is Spouse or Domestic Partner
        .
      • Business Object
        :
        Dependent
        .
      • Function
        :
        True/False Condition
        .
    2. Click
      OK
      .
    3. On the
      Calculation
      tab, enter these values:
      • Field
        :
        Relationship
        .
      • Operator
        :
        In the selection list
        .
      • Comparison Type
        :
        Value specified in this filter
        .
      • Comparison Values:
        Domestic Partner
        and
        Spouse
        .
    4. Click
      OK
      .
  2. Create the second calculated field.
    1. Access the
      Create Calculated Field
      task and enter these values:
      • Field Name
        :
        Benefit Election - Count of Spouse or Domestic Partner Dependents
        .
      • Business Object
        :
        Benefit Election
        .
      • Function
        :
        Count Related Instances
        .
    2. Click
      OK
      .
    3. On the
      Calculation
      tab:
      • Related Field
        :
        Dependents
      • Count
        : Select the
        Instances where condition is true
        option and select
        Is Spouse or Domestic Partner
        from the list.
    4. Click
      OK
      .
  3. Create the custom validation.
    1. Access the
      Maintain Custom Validations
      task.
    2. Select
      Benefit Election
      on the left panel.
    3. Click
      New Validation
      for
      Critical
      severity.
    4. Enter
      Add only 1 spouse or domestic partner.
      in the
      Description
      field.
    5. In the
      Rule Conditions
      grid, enter these values:
      Field
      Value
      Source External field or Condition Rule
      Benefit Election - Count of Spouse or Domestic Partner Dependent
      Relational Operator
      Greater than or equal to
      Comparison Type
      Value specified in this filter
      Comparison Value
      2
    6. Click
      OK
      .
  4. Configure the validation message.
    1. From the related actions menu of the
      Add only 1 spouse or domestic partner.
      custom validation, select
      Validation
      Configure Validation Message
      .
    2. Select the
      Text
      option and enter this message:
      Add only 1 spouse or domestic partner
      . Click
      OK
      .
    3. Add another row and select the
      External Field
      option. Enter this text:
      Benefit Coverage Type
      . Click
      OK
If workers attempt to enroll more than one spouse or domestic partner as a dependent, they receive a critical error that prevents them from making an enrollment error.
When workers create an additional spouse or domestic partner as a dependent during an enrollment event, Workday creates a Dependent Event transaction in the background. The worker will see the duplicate dependent when viewing their dependents. You can create a report to audit for duplicate dependents so that you can delete the duplicates.