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:
- Search and select the relevant project and click Select. The Visual builder studio page appears.
- Click Validate Field Values in the Business Rules section under Validations, and click + Validation.
- Select the Rule Type as Regular and type the Label, ID and Description, and click Create.
- Edit the new rule created under the Extension Rules section.
- Select France as the Country so that this rule applies to France only and click Done.
- Click .
- 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 }; });
- 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
- Save the changes.
- In the Detail section, type the user defined error message.Note: The text entered here will appear on the screen when the validation fires.
- Click the ► icon to verify the code changes to the instance.
- When the application opens in a new browser, you can verify the hire flow rule.
- Enter the required details in the When and Why, Personal Details and Assignment section.
- In the Contract Info section, enter an invalid Contract Number to test the rule. This will trigger an error message.
- Enter the valid Contract Number and publish your updates.