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.

images/download/attachments/201665047/image-2025-3-26_11-8-6-version-1-modificationdate-1742983685584-api-v2.png

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).

images/download/attachments/201665047/image-2025-3-26_11-9-16-version-1-modificationdate-1742983755222-api-v2.png

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'.

images/download/attachments/201665047/image-2025-3-26_11-10-12-version-1-modificationdate-1742983811537-api-v2.png

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:

  • In the first step, a Check type for the reference object present as an input value ensures that an 'entity' is present. This groups together 'entities' of different types that may or may not be 'Working state owners'.

  • The second step is to determine whether the reference object has a 'Current working state'. For this purpose, the Object property currentWorkingState is accessed within a With rule in order to subject the return value to a further Check type. The type tested is the 'Working state entry' type. This type summarizes the specific types of 'Working state entries' for different 'Working state owners'. So the rule is passed if the original reference object in the input value is a 'Working state owner' according to the type 'AND' and it already has a 'Current working state'.
    NOTE◄ An Entity property rule that checks the currentWorkingState field for 'not empty' would be less precise, since the reference object could use a field with the same name for any other content.

  • Since the first two rules ensure that the reference object has a 'Current working state', the third step is the Current working state rule, which checks against the working state value 'New' and negates the result (see Not rule).

images/download/attachments/201665047/image-2025-3-26_11-13-10-version-1-modificationdate-1742983989273-api-v2.png

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:

  • A Check type is performed at input, which ensures that the current reference object is an 'Account' entity.

  • Below (on the left in the 'OR' link), a Current working state rule rule checks whether the 'Current working state' of the account refers to the Working state 'New'.

  • Below (on the right side of the 'OR' junction), it is checked whether the account has been saved or not. For this purpose, the 'Created' (created) field is subjected to an Is empty comparison. Since the 'Created' date is automatically set when an entity is saved, the field is usually empty until the account is 'created' (via 'Save'). Alternatively, you could also check the currentWorkingState field per Is empty, since a 'Current working state' is also automatically assigned when an account is saved for the first time.

images/download/attachments/201665047/image-2025-3-26_11-15-14-version-1-modificationdate-1742984113691-api-v2.png