You can further refine your Product configuration model by adding constraints. These are rules that allow you to restrict what values are allowed to be entered in the attributes based on the values of other attributes.
NOTE: This is part of the Building Dynamic Products with the Product Configurator blueprint series where we show how to configure product configuration models within Dynamics AX, and use them to create dynamics BOM’s and Routes based on the configurations. If you want to see all of the other posts in this series, click here.
How to do it…
To add constraints to your configuration model, follow these steps:
- To create constraints, open the Product configuration model maintenance form and expand the Constraints panel. From the Constraints menu bar, click on the Add menu button.
- When the new constraint dialog box is displayed, select the Expression constraint option from the Constraint drop down list. This will allow us to write a simple expression that defines what restrictions we are placing on the attribute.
- Give your constraint a Name, and Description.
- In the Expression field we will now write our rule that will tell Dynamics AX what is valid and what isn’t, using the Implies
function. The format is:Implies[AttributeRuleIsImplied, WhenAttributeRuleIsTrue]
i.e. WhenAttributeRuleIsTrue (then) AttributeRuleIsImplied
Implies[Cable1 == “CT-AV1″, Port1==”PT-AV”]
i.e. When Port1 is “AV” then Cable1 may be “CT-AV1”
- Repeat the step and add as many constraints as you like.
How it works…
To see it in action by clicking on the Test button in the Run group of the Model ribbon bar. Notice that the attribute values that are not allowed are not checked, and also cannot be selected.