Code Example: Payroll Election Request Form

XML Forms Guide

Version
R2024.1.1
Code Example: Payroll Election Request Form

The following is an example of code for a payroll election deduction request form. The form can be used to request new deductions or change the scheduled amount of existing deductions.

Before You Begin: In this code, you need to define which specific deductions users can select. See Define Available Deductions.

Copy
<WF_DynamicForm>
    <DataClass>Employee</DataClass>
    <ValidationRule Event="OnSubmit" Type="PayrollEmployeeElectionValidationRule" />
    <FormHeader>
        <Style>header</Style>
        <Title>Payroll Election Request</Title>
    </FormHeader>
    <!-- Used Class for EmployeeEmploymentStatus -->
    <UsedClass>
        <Name>List_EmployeeEmploymentStatus</Name>
        <Mode>Current</Mode>
        <AddNewInstanceIfEmpty>true</AddNewInstanceIfEmpty>
        <DefaultStatus>Insert</DefaultStatus>
    </UsedClass>
    <UsedClass>
        <Name>EmployeeDeduction</Name>
        <Mode>Current</Mode>
        <AddNewInstanceIfEmpty>true</AddNewInstanceIfEmpty>
        <DefaultStatus>Insert</DefaultStatus>
    </UsedClass>
    <EmployeeHeaderPanel>
        <Style />
    </EmployeeHeaderPanel>
    <FormBody>
        <Style>IVFormBody</Style>
        <Block>
            <Style />
            <NumberOfColumns>4</NumberOfColumns>
        </Block>
        <Field>
            <!-- Validation Control on Employee's Current Election Set-->
            <!-- Set InitialValue to True to only allow updates to existing elections set to False to allow new election requests-->
            <Style>IVCheckBox</Style>
            <BindingProperty>EmployeeDeduction.DisableNewElection</BindingProperty>
            <IsRequired>False</IsRequired>
            <Visible>False</Visible>
            <InitialValue>False</InitialValue>
        </Field>
        <!-- Row 1 -->
        <Panel>
            <Style>IVPanel</Style>
            <Caption>Payroll Election Request</Caption>
            <Row>1</Row>
            <Column>0</Column>
            <ColumnSpan>4</ColumnSpan>
        </Panel>
        <!--  Row 2 -->
        <Label>
            <Style>InLineHelpLabel</Style>
            <Caption>I authorize voluntary withholding for the selected payroll election deduction in the amount or percent indicated below as of the specified start date.</Caption>
            <MarkAsRequired>False</MarkAsRequired>
            <Row>2</Row>
            <Column>0</Column>
            <ColumnSpan>4</ColumnSpan>
        </Label>
        <!--  Row 3: Deduction Code Label -->
        <Label>
            <Style>IVLabel</Style>
            <Caption>lblDeductionCode</Caption>
            <MarkAsRequired>True</MarkAsRequired>
            <Row>3</Row>
            <Column>0</Column>
        </Label>
        <!--  Row 3: Start Date Label -->
        <Label>
            <Style>IVLabel</Style>
            <Caption>lblStartDate</Caption>
            <MarkAsRequired>True</MarkAsRequired>
            <Row>3</Row>
            <Column>1</Column>
        </Label>
        <!--  Row 4: Deduction Code Field -->
        <Field>
            <Style>VComboBox</Style>
            <Block>1</Block>
            <Row>4</Row>
            <Column>0</Column>
            <BindingProperty>EmployeeDeduction.PRDeductionXrefCode</BindingProperty>
            <DataProvider>AllDeductions</DataProvider>
            <DisplayMemberPath>ShortName</DisplayMemberPath>
            <SelectedValuePath>XRefCode</SelectedValuePath>
            <IsReadOnly>False</IsReadOnly>
            <Visible>True</Visible>
            <IsRequired>False</IsRequired>
            <InitialValue>NULL</InitialValue>
            <Filter>
                <FieldName>XRefCode</FieldName>
                <FieldValue></FieldValue>
            </Filter>
        </Field>
        <!--  Row 4: Start Date Field -->
        <Field>
            <Style>IVDatePicker</Style>
            <Block>1</Block>
            <Row>4</Row>
            <Column>1</Column>
            <BindingProperty>EmployeeDeduction.ElectEffectiveStart</BindingProperty>
            <IsRequired>False</IsRequired>
            <InitialValue>Function:now</InitialValue>
            <Visible>True</Visible>
        </Field>
        <!--  Row 5: AmountPercent Label-->
        <Label>
            <Style>IVLabel</Style>
            <Caption>Amount / Percent</Caption>
            <MarkAsRequired>True</MarkAsRequired>
            <Row>5</Row>
            <Column>0</Column>
        </Label>
        <!--  Row 5: Value Label -->
        <Label>
            <Style>IVLabel</Style>
            <Caption>Value</Caption>
            <MarkAsRequired>True</MarkAsRequired>
            <Row>5</Row>
            <Column>1</Column>
        </Label>
        <!--  Row 6: AmountPercent Field -->
        <Field>
            <Style>VComboBox</Style>
            <Block>1</Block>
            <Row>6</Row>
            <Column>0</Column>
            <BindingProperty>EmployeeDeduction.ValueType</BindingProperty>
            <DataProvider>AmountPercents</DataProvider>
            <DisplayMemberPath>ShortName</DisplayMemberPath>
            <SelectedValuePath>XRefCode</SelectedValuePath>
            <IsReadOnly>False</IsReadOnly>
            <Visible>True</Visible>
            <IsRequired>False</IsRequired>
        </Field>
        <!--  Row 6: Value Field -->
        <Field>
            <Style>IVTextBox</Style>
            <Row>6</Row>
            <Column>1</Column>
            <BindingProperty>EmployeeDeduction.Value</BindingProperty>
            <IsRequired>False</IsRequired>
            <Visible>True</Visible>
        </Field>
        <!-- Row 7: Required Warning -->
        <Label>
            <Style>InLineHelpLabel</Style>
            <Caption>*Fields marked with an asterisk are required.</Caption>
            <MarkAsRequired>False</MarkAsRequired>
            <Row>7</Row>
            <Column>0</Column>
            <ColumnSpan>4</ColumnSpan>
        </Label>
        <!-- Row 8: end form line -->
        <Panel>
            <Style>IVPanel</Style>
            <Caption>Please Note</Caption>
            <Row>8</Row>
            <Column>0</Column>
            <ColumnSpan>4</ColumnSpan>
            <Visible>True</Visible>
        </Panel>
        <!-- Row 9: Comment caption -->
        <Label>
            <Style>InLineHelpLabel</Style>
            <Caption>Your payroll election request will be routed for approval. It may take several days for the request to be approved. Once approved, your election will be effective as of the date indicated above. For questions, please contact your payroll department.</Caption>
            <MarkAsRequired>False</MarkAsRequired>
            <Row>9</Row>
            <Column>0</Column>
            <ColumnSpan>4</ColumnSpan>
        </Label>
        <!-- Row 10: Employee Comment -->
        <SimpleComment>
            <Caption>Comment</Caption>
            <Row>10</Row>
            <Column>0</Column>
            <ColumnSpan>4</ColumnSpan>
            <BindingProperty>EmployeeDeduction.EmployeeComment</BindingProperty>
        </SimpleComment>
    </FormBody>
</WF_DynamicForm>