Rules (form) [AX 2012]

Updated: July 21, 2011

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

Click Product information management > Setup > Product builder > Global rules.

Use this form to create and view local and global validation rules. The number of tabs and fields displayed depends on the type of rule you are creating.

NoteNote

We recommend that you do not use this form, because it is being officially deprecated and may be removed, and may not be available in future versions of Microsoft Dynamics AX.

In the Filter section, you can select to view all or a subset of the rules. Values that are selected there are used as predefined values for the corresponding fields while creating new rules.

The following tables provide descriptions for the controls in this form.

Filter

Description

Local/Global

Select to view all the rules (All), or only those of the type Local or Global type.

Validation type

Select to view all the rules (All), or only those of the type Constraint, Formula, or Action.

Rule set number

To view all the rules that belong to a specific rule set number, specify its unique identifier.

Product model

To view all the rules for a specific product model, specify its unique identifier.

Variable

To view all the rules for a specific variable, specify its name identifier.

Value

To view all the rules for a specific value of the variable specified in the Variable field, select the value.

Tab

Description

Overview

Create the header of the rule, and specify its type and clause number. Then type the description and select the rule set number (for global rules) or product model number (for local rules).

Formula setup

Create a formula to calculate a variable value. This tab is visible only for validation rules of the Formula type.

Condition

Create a condition for Constraint or Action. This tab is visible only for validation rules of the Action and Constraint types.

Actions

Define actions to be performed when a condition created on the Condition tab becomes true or false. This tab is visible only for validation rules of the Action type.

Message

Create messages to be displayed when a condition created on the Condition tab becomes true or false. This tab is not visible for validation rules of the Formula type.

Button

Description

Check rule syntax

Verify the syntax of the rule that you created. The result is displayed in the Infolog and the Rules checked field.

Copy

Copy global or local validation rule clause.

Button

Description

Calculated

Create an expression to calculate the variable value (for formulas and actions), or the value to be compared with the variable value (for simple conditions).

Transfer to program code

Convert the condition to program code. If you click this button while creating a Simple or Advanced condition, its type changes to Code.

Return to lines

Change from code to the lines of the Simple or Advanced condition that were used to generate it, and then back to code.

Up, Down

Define the order in which actions will be run.

Field

Description

Local/Global

Select whether the rule is local or global. Note that global validation rules can be created only for modeling variables, not for calculation variables.

Version

Select the rule set number for global rules or the product model number for local rules.

Clause number

Type the unique number for the clause.

Description

Type the name of the validation rule.

Validation type

Select the type of validation rule:

  • Formula – Calculate the variable value.

  • Action – Define actions to be performed if a certain condition becomes true or false.

  • Constraint – Set up an exception condition, that is, a condition which must not exist.

Rules checked

Indicates whether the created rule syntax is correct.

NoteNote

To check the rule, click Check rule syntax.

Variable

Select the variable that will receive the value calculated according to the formula.

Index

If the variable that is selected in the Variable field belongs to the array group, specify the index (position number) of the array element to which the rule will apply here.

Type

Select whether the variable specified in the Variable field will receive a specific value or will be calculated according to a formula. If you select Value, you will have to specify it in the Outcomes field. If you select Calculated, click the Calculated button to create a formula.

Outcomes

Specify the value for the variable that is selected in the Variable field if the Type field is set to Value.

Recalculate

Select to recalculate the rules containing the variable that is selected in the Variable field.

Type

Select the type of condition you want to create:

  • Simple – Create simple conditions.

  • Advanced – Create more complicated expressions.

  • Code – Create expressions in the X++ programming language.

Variable

Select the name of the variable for the current line.

Index

If the variable that is selected in the Variable field belongs to the array group, specify the index (position number) of the array element used in the condition here.

Operator

Select an operator for the current line. The following operators are available:

=

equal

!=

not equal

>

greater than

<

less than

>=

greater or equal

<=

less or equal

Like

like

Type

Select if the variable specified in the Variable field will receive a specific value or will be calculated according to a formula.

  • If you select Value, specify it in the Value field.

  • If you select Calculated, click Calculated to create a formula.

Value

Specify the value for the variable that is selected in the Variable field if the Type field is set to Value.

Type

Select whether the current line operand is a fixed value or a variable.

Text

Select or type the operand for the logical expression that you are creating. Depending on the value you selected in the Type field, the operand can be either a fixed value or one of your variables for the product model. If you specify a variable that is an array, you must specify the array index in the Index field.

When the Type field is set to Variable, you can click the arrow button next to the Text field to view a list of available variables.

NoteNote

When the Type field is set to Value, you need to consider the data type of the values that you enter. Text values must be enclosed in single quotation marks ('), otherwise Microsoft Dynamics AX will interpret the text as a variable name, and you will receive an error message. By contrast, numerical values should not be enclosed in quotation marks.

Index

If you specify in the Type field that the operand on this line is a variable, and if the variable that you specify in the Text field is an array, specify the array index that is relevant for the current expression.

(The array index is the position number of a specific array element.)

Operator

Specify an operator that connects the current line with the next line - to form a logical expression. The following operators are available (listed in order of operator precedence):

* /

multiplication, division

+ -

plus, minus

> < >= <=

greater than, less than, greater or equal, less or equal

= !=

equal, not equal

and or

logical and/or

Variable

Select variables to use while creating an X++ expression in the Code field.

Index

If the variable that is selected in the Variable field belongs to the array group, specify the index of the element that is relevant for the current expression here.

Description

Type the description of the variable that is selected in the Variable field.

Code

Type the expression in X++ code directly. The expression must be formulated as an X++ method that returns a boolean value.

When you edit an expression in the Code field, you can make it as sophisticated as you want by using all the tools of the X++ language in Microsoft Dynamics AX. For a description of the X++ language, refer to the Microsoft Dynamics AX Developer's Guide.

Variable

Select the name of the variable that will be modified by the current action.

Index

If the variable that is selected in the Variable field belongs to the array group, specify the index of the element that is relevant for the current expression here.

Field properties

If the condition is true, set up the display properties of the field that contains the variable selected in the Variable field:

  • Hide – Field will not be displayed in the Product Builder configuration form.

  • Show only – The field will be visible but not editable.

  • Allow edit – The user will be able to modify the field in the Product Builder configuration form.

  • Mandatory – The user will be required to modify the field in the Product Builder configuration form.

Type

Select whether the variable specified in the Variable field will receive a specific value or will be calculated according to a formula if the condition is true. If you select Value, specify the value in the Value field. If you select Calculated, use the Calculated button to create a formula.

Value

Specify the value for the variable that is selected in the Variable field if the Type field is set to Value. The variable will receive this value if the condition is true.

Recalculate

Recalculate the rules that contain the variable specified in the Variable field.

Field properties

If the condition is false, set up the display properties of the field that contains the variable selected in the Variable field:

  • Hide – The field will not be displayed in the Product Builder configuration form.

  • Show only – The field will be visible but not editable.

  • Allow edit – The user will be able to modify the field in the Product Builder configuration form.

  • Mandatory – The user will be required to modify the field in the Product Builder configuration form.

Type

Select whether the variable specified in the Variable field will receive a specific value or will be calculated according to a formula if the condition is false. If you select Value, specify the value in the Value field. If you select Calculated, use the Calculated button to create a formula.

Value

Specify the value for the variable that is selected in the Variable field if the Type field is set to Value. The variable will receive this value if the condition is false.

Recalculate

Recalculate the rules that contain the variable specified in the Variable field.

Language

Select the language code for the current message.

Text

Type the message text to be displayed if the condition is true.

Text (if false)

Type the message text to be displayed if the condition is false.

Condition on action

A logical representation of the condition that you are creating.

Formula

A logical representation of the formula that you are creating.

Error if true

A logical representation of the condition that you are creating.


Announcements: To see known issues and recent fixes, use Issue search in Microsoft Dynamics Lifecycle Services (LCS).

Community Additions

Show: