Use a Named Rule

XML Forms Guide

Version
R2025.1.0
Use a Named Rule

Named rules are predefined validations that you can use without defining them yourself.

To use a named rule validation, include the following elements:

  • a <ValidationRule> tag where Type=the name of the rule
  • a ValidationFailureMessage parameter

The ValidationFailureMessage parameter provides the error message to be shown if the form data doesn’t satisfy the rule. You can use a literal string, or a variable that can be localized.

For example:

Copy
<ValidationRule Event="OnSubmit" 
    Type="MustHaveExactlyOnePrimaryResidenceRule">
    <Parameter Name="ValidationFailureMessage">
        You cannot designate multiple addresses as your 
        primary residence.
    </Parameter>
</ValidationRule>
Available named rules
Rule Name Description
ElectronicStatementAcknowledgementRule Ensures that the policy acknowledgment checkbox is selected when the user submits the form.
EmailsMustBeValidRule Ensures that the email addresses provided for an employee and their emergency contacts are valid and not missing.
EmergencyContactMustHaveRelationshipTypeRule Ensures the following:
  • That the employee's emergency contacts are configured with a relationship type.
  • That first and last names are entered for the emergency contact.
EmergencyContactValidationRule Ensures that the First Name, Last Name, and Phone Number fields in the Emergency Contacts section of forms are filled out. The rule only runs if at least one setting in the Emergency Contacts section is filled out, so that users can still submit the form without adding any emergency contact information.
EmployeeLoginIdMustBeUniqueRule Ensures that the employee's user name is unique in Dayforce.
EmployeeNumberMustBeUniqueRule Ensures that the employee's employee number is unique in Dayforce.
EmployeePhoneNumberValidationRule Ensures that the employee's phone numbers are in a valid format.
EmployeeRateAndSalaryGreaterThanJobPayGradeRule Ensures that the employee's pay rate is greater than the minimum value configured for the pay grade associated with the employee's job.
EmployeeRateGreaterThanMinimumWageRule Ensures that the employee's pay rate is greater than the minimum wage value configured for the geographic location (province, territory, state, or specific city) based on the employee's work location.
EmployeeZipCodeValidationRule Ensures that the employee's ZIP code or postal code is in a valid format.
MustHaveExactlyOnePrimaryResidenceRule Ensures that the employee has one and only one address marked as the primary residence.
MustHaveOpenPayPeriodRule

Ensures that pay adjustments are made in an open pay period for employees.

NoEmailForWelcomeMessageValidationRule Validates that a valid email address is provided for sending a welcome message to new employees.
NormalHoursGreaterThanZero Confirms that the value in the Normal Hours field is greater than zero.
OnlyOneEffectiveStartPrimaryResidenceRule Ensures that the employee has one and only one primary residence address with a specified start date. If two or more primary address records are defined with the same effective start date, the form shows an error.
PreStartDateGreaterThanHireDateValidationRule Confirms that the value in the pre-start record is greater than (later than) the Hire Date field value.
SocialSecurityNumberDuplicateRule If the employee’s National ID Number (for example, SSN or SIN) has changed, verifies that the new number isn’t a duplicate of an existing number.
SocialSecurityNumberExistRule Ensures that the employee's SSN or SIN was previously saved in an employee record. If the number isn’t associated with a terminated employee, because it doesn’t exist on any employee records or it’s associated with an employee that hasn’t been terminated, Dayforce shows a warning message.
SocialSecurityNumberValidationRule

Ensures that the employee's SSN or SIN is in a valid format.

This rule can be associated with the PreventRehireFromNewHireForm parameter, which can be configured with a 'True' or 'False' value. When the parameter is configured as 'True', the application shows an error message when the form is submitted for an employee whose SSN or SIN already exists in the application.

In addition, the rule requires an additional line to invoke the rule during the pre-save process:

<PreSaveProcess Type="DefaultNewHireXMLPreSaveProcess" PreventRehireFromNewHireForm="True" />

For more information, see the example below.

TelecommuterPercentageValidationRule Validates the data that is entered into the Telecommuter % field. If a value outside 0-100 is entered, Dayforce displays an error message. Also, if a value is submitted in the Telecommuter % field for someone in a non-US paygroup, Dayforce displays a warning message but the form can still be processed.
WorkAssignmentRateChangeAgainstPayGradeRule Ensures that if Restrict Out Of Grade is selected for the pay grade an employee belongs to, their job or alternate rate can’t be saved if it’s outside the minimum and maximum range.

Example: Using Named Rules

To configure a form that includes named rules, define the rules after the <DataClass> tag and before the <FormHeader>:

Copy
<WF_DynamicForm>
   <DataClass>Employee</DataClass>
    <ValidationRule Type="EmployeeLoginIdMustBeUniqueRule" 
        Event="OnSubmit" />
    <ValidationRule Type="EmployeeNumberMustBeUniqueRule" 
        Event="OnSubmit" />
    <ValidationRule Type="EmployeePhoneNumberValidationRule" 
        Event="OnSubmit" />
    <ValidationRule Type="SocialSecurityNumberDuplicateRule" 
        Event="OnSubmit">
        <Parameter Name="PreventRehireFromNewHireForm">
        True
        </Parameter>
    </ValidationRule>
    <ValidationRule Type="SocialSecurityNumberAndExpiryDateValidationRule" Event="OnSubmit" />
    <ValidationRule Type="CountyRequiredForPrimaryAddressRule" Event="OnSubmit" />
    <ValidationRule Type="EmployeeRateIsRequired" Event="OnSubmit" />
    <PreSaveProcess Type="DefaultNewHireXMLPreSaveProcess" PreventRehireFromNewHireForm="True" />
    ...
</WF_DynamicForm>