Set Up the Validation Rule for Employment Contracts

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

To set up the validation rule for employment contracts:

Fastpath:

My Client Groups > Employment Contracts > Search by name, person number, or assignment number > Settings and Actions > Edit Page in Visual Builder Studio

  1. Click Validate Field Values in the Business Rules section under Validations, and click + Validation.
  2. Select the Rule Type as Regular and type the Label, ID, Description, and click Create.
  3. Edit the new rule created under the Extension Rules section.
  4. Select France as the Country so that this rule applies to France only and click Done.
  5. Click Edit > Use Advanced Expression > Code.
  6. Replace the java script code with the following:
    /* eslint-disable dot-notation */
    define([], () => {
      'use strict';
    
      /**
       * France Contract Number - Employment contract changes.
       * @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 };
    });
  7. 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
  8. Save the changes.
  9. In the Detail section, type the user defined error message.
    Note: The text entered here will appear on the screen when the validation fires.
  10. Click the ► icon to verify the code changes to the instance.
  11. When the application opens in a new browser, you can verify the hire flow rule.
  12. Enter the required details in the When and Why, Personal Details and Assignment sections.
  13. In the Contract Info section, enter an invalid Contract Number to test the rule. This will trigger an error message.
  14. Enter the valid Contract Number and publish your updates.