10.2.5.4. Creating a guided rule to match skills to shift requirements
The ShiftReqiredSkillsAreMet guided rule creates a hard constraint that ensures all shifts are assigned an employee with the correct set of skills. In the employee rostering example, this constraint is created using the guided rule designer.
Procedure
-
In Business Central, go to Menu
Design Projects and click the project name. -
Click Add Asset
Guided Rule. -
Enter
ShiftReqiredSkillsAreMetas the Guided Rule name and select theemployeerostering.employeerosteringPackage. - Click Ok to create the rule asset.
-
Add a WHEN condition by clicking the
in the WHEN field.
-
Select
ShiftAssignmentin the Add a condition to the rule window. Click +Ok. -
Click the
ShiftAssignmentcondition, and selectemployeefrom the Add a restriction on a field drop-down list. -
In the designer, click the drop-down list next to
employeeand selectis not null. Click the
ShiftAssignmentcondition, and click Expression editor.-
In the designer, click
[not bound]to open the Expression editor, and bind the expression to the variable$requiredSkill. Click Set. -
In the designer, next to
$requiredSkill, selectshiftfrom the first drop-down list, thenrequiredSkillfrom the next drop-down list.
-
In the designer, click
Click the
ShiftAssignmentcondition, and click Expression editor.-
In the designer, next to
[not bound], selectemployeefrom the first drop-down list, thenskillsfrom the next drop-down list. -
Leave the next drop-down list as
Choose. -
In the next drop-down box, change
please choosetoexcludes. -
Click the
icon next to excludes, and in the Field value window, click the New formula button. -
Type
$requiredSkillinto the formula box.
-
In the designer, next to
-
Add the THEN condition by clicking the
in the THEN field.
-
Select
Modify Hard Scorein the Add a new action window. Click +Ok. -
Type
-1into the score actions box. - Click Validate in the upper-right corner to check all rule conditions are valid. If the rule validation fails, address any problems described in the error message, review all components in the rule, and try again to validate the rule until the rule passes.
- Click Save to save the rule.
For more information about creating guided rules, see Designing a decision service using guided rules.