Set Up the Validation Rule for New Hires

Login to VBCS enabled Instance https://<host> /fscmUI/faces/FuseOverview.

To set up the validation rule for new hires:

Fastpath:

My Client Groups > Hire an Employee > Settings and Actions > Edit Page in Visual Builder Studio

  1. Search and select the relevant project and click Select. The Visual builder studio page appears.
  2. Click Validate Field Values in the Business Rules section under Validations, and click + Validation.
  3. Select the Rule Type as Regular and type the Label, ID and Description, and click Create.
  4. Edit the new rule created under the Extension Rules section.
  5. Select France as the Country so that this rule applies to France only and click Done.
  6. Click Edit > Use Advanced Expression > Code.
  7. Replace the java script code with the following code.
    /* eslint-disable dot-notation */
    define([], () => {
      'use strict';
    
      /**
       * France Contract Number Validation.
       * @param {object} context
       * @return {boolean}
       */
      function runCondition(context) {
        const { $componentContext, $fields, $modules, $user } = context;
    
        if (($componentContext.Country.includes('FR'))
         && (! $fields.employmentContracts.ContractNumber.$value().match(/^[0-9a-zA-Z]{5,20}$/)) ) {
          return true;
        }
        return false;
      }
      return { runCondition };
    });
  8. Click Save and then, enter the following details data in the Messages section:
    • Summary: Enter a summary of the rule. E.g: Invalid Contract Number
    • Severity: Error
    • Target Fields: ContractNumber
  9. Save the changes.
  10. In the Detail section, type the user defined error message.
    Note: The text entered here will appear on the screen when the validation fires.
  11. Click the ► icon to verify the code changes to the instance.
  12. When the application opens in a new browser, you can verify the hire flow rule.
  13. Enter the required details in the When and Why, Personal Details and Assignment section.
  14. In the Contract Info section, enter an invalid Contract Number to test the rule. This will trigger an error message.
  15. Enter the valid Contract Number and publish your updates.