Creating a Rule to Update Required Option for Guardian

If the customer’s age is below 21, the name of the guardian becomes a required field. You can create a rule that updates the required option on the control Guardian Name based on Customer Age parameter value.

Procedure

  1. Select the Customer Age (CustAge) parameter from the Data node of Outline view on the Capture Claim form.
  2. Click the Rules tab on the Properties view.
  3. Click the Add Rule button next to the event type Update (update).

    The Rule Details dialog opens.

  4. Type the following values for the input fields on Rule Details screen and click Next:
    • Name:
      set_guardian_required
    • Label:
      Guardian required when Age < 21.
  5. Leave the Update (update) event type in the Rule: Pick Events dialog unchanged, and click Next.

    The Define Actions dialog opens.

  6. Click the (plus) button .

    The Add Action to Rule dialog opens.

  7. Select the radio button Create a new action and then Script Action.
  8. Click Next.

    The Enter the action details dialog opens.

  9. Type the following values in the input fields, and click Finish.
    • Name:
      set_guardian_required
    • Label:
      If customer age is less than 21, it will set the guardian field as required.
  10. Type the following script:
    context.form.logger.info('set_guardian_required: Customer age     received:' + context.newValue);
    var age = context.newValue;
    control.GuardianName.setRequired(age < 21);
  11. Click Finish twice.
    Note: You can test this rule by selecting a birth date that is less than 21 years ago from today.