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.- Create the first calculated field.
- Access theCreate Calculated Fieldtask and enter these values:
- Field Name:Is Spouse or Domestic Partner.
- Business Object:Dependent.
- Function:True/False Condition.
- ClickOK.
- On theCalculationtab, enter these values:
- Field:Relationship.
- Operator:In the selection list.
- Comparison Type:Value specified in this filter.
- Comparison Values:Domestic PartnerandSpouse.
- ClickOK.
- Create the second calculated field.
- Access theCreate Calculated Fieldtask and enter these values:
- Field Name:Benefit Election - Count of Spouse or Domestic Partner Dependents.
- Business Object:Benefit Election.
- Function:Count Related Instances.
- ClickOK.
- On theCalculationtab:
- Related Field:Dependents
- Count: Select theInstances where condition is trueoption and selectIs Spouse or Domestic Partnerfrom the list.
- ClickOK.
- Create the custom validation.
- Access theMaintain Custom Validationstask.
- SelectBenefit Electionon the left panel.
- ClickNew ValidationforCriticalseverity.
- EnterAdd only 1 spouse or domestic partner.in theDescriptionfield.
- In theRule Conditionsgrid, enter these values:FieldValueSource External field or Condition RuleBenefit Election - Count of Spouse or Domestic Partner DependentRelational OperatorGreater than or equal toComparison TypeValue specified in this filterComparison Value2
- ClickOK.
- Configure the validation message.
- From the related actions menu of theAdd only 1 spouse or domestic partner.custom validation, select .
- Select theTextoption and enter this message:Add only 1 spouse or domestic partner. ClickOK.
- Add another row and select theExternal Fieldoption. Enter this text:Benefit Coverage Type. ClickOK
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.