Current working state rule
Rule type – Abstract
Purpose: Is considered 'passed' if a certain Working state value is regarded as 'current' for the reference object.
The Current working state rule is considered 'passed' if the Working state statically selected in the configuration matches the current Working state of the reference object for the rule.
Only entities whose type qualifies as 'Working state owner' are eligible as reference objects. This applies to all business transaction objects (Common business object, Orders, Manifests, Shipments and time slot book entries) and Custom type definition with the expansion Working state owner.
In the header data of the reference object, the rule examines the 'Current working state' field (currentWorkingState). This field refers to the current entry in the entity's working state history, unless it is completely empty because the entity has never been saved.
►NOTE◄ The current working state is always the last working state entry added. Time entries in the 'Realization time' field (realization) of the working state entry have no effect on this.
Within the data for the 'Current working state' entry (currentWorkingState), the 'Working state' field (workingState) refers to a value from the dynamic enumeration Working state. The rule compares this value with the selection in the configuration.
The Current working state rule is considered 'failed' if at least one of the following conditions is true:
There is no reference object.
The reference object cannot have a 'working state'.
The reference object has not yet been assigned a 'Current working state'.
The 'Current working state' (currentWorkingState) of the reference object refers to a 'working state' (workingState). that does not match the Working state specified in the rule configuration.
Configuration
The Current working state rule expects a reference object of a type qualified as 'Working state owner' (see above).
The Combobox for the only parameter of the configuration can be used to select a Working state from the relevant dynamic enumeration by single selection.
As shown in the image, when text is entered, the integrated search function takes into account both the internal name (name) of the dynamic enumeration values and the localization applicable in the context of the session.
If no working state is selected, the rule is always considered as failed. It would only apply if the workingState field was present in the current working state but empty. Since each Working state value must be identified by a name, this case is excluded for an entity with regular data.
►NOTE◄ Multiple selection is not supported. Therefore, if required, multiple instances of the Current working state rule must be combined in an 'OR' operation (see example).
►IMPORTANT◄ If Dynamic enum filters are applicable for the Working state in the context of a session, they also restrict the selection of the Working state in the course of configuration. However, Dynamic enum filters have no influence on the evaluation of the Current working state rule at runtime.
Example
Simple example
An association criterion is said to apply if the data context contains an entity as an input value whose current work status is 'Finished' or 'Canceled'.
Configuration:
Since the Current working state rule provides selection for only exactly one Working state, it must be configured twice to cover the requirement with two accepted state values. The second instance of the rule can be added to the existing rule after clicking on the 'OR' icon on the right margin. ►NOTE◄ In this configuration, a Check type is technically not required. If there is no 'attribute owner' as an input value, the rule is simply 'failed'. |
|
More complex example
An association criterion is said to apply if there is an entity in the data context as an input value for which a 'Current working state' other than 'New' applies.
Configuration:
The described requirement cannot be covered precisely by configuring a Current working state rule with the Working state 'New' similar to the above example and simply negating this rule (see Not rule).
Why? The simplified rule ('Current working state is not 'New') would be satisfied even if the input value is not an entity, or if the input value is an entity that does not (or not yet) have a 'Current working state'. However, according to the requirement, in these cases the rule should be considered as 'failed'. This can only be achieved by a somewhat more complex configuration.
The association criterion shown on the right achieves the logic described in the requirement by an 'AND' operation of three rules:
|
|
Special use case
For a created entity of a type that is defined as a 'Working state owner', the 'Current working state' – by default 'New' (NEW) or a different default working state, depending on configured Working state matrix) – is assigned for the first time during 'Create' (see Common action event). Often, the same rules or associations should apply to a newly created entity before it is 'saved' as to an entity with the initial 'Current working state' (e.g. 'New'). This must be explicitly regulated, as in the following example.
Certain ribbon buttons in a input form for a Custom entity (s. Custom type definition) 'Account' should only be displayed as long as the form shows the data of a 'new' account. An account should be considered as 'new' as long as the working state 'New' is current OR if the account has not been saved yet.
Configuration:
The configuration for an association criterion shown on the right shows a rule that qualifies a 'new' account:
|
|