With rule
See also: Execute with (Event action)
Rule type – Abstract
Purpose: Is considered 'passed' if the rule configured within is considered 'passed' for the alternative reference object defined via a value resolver.
A With rule allows the temporary change of the reference object within a rule definition in order to evaluate one or more rules with an alternative reference object.
►NOTE◄ The use of the With rule within a rule definition is similar to that of an Execute with event action within an event action.
The alternative reference object is defined at runtime via the Resolvers in the Entity property resolver parameter. The name of the parameter refers to a typical use of the With rule, namely accessing a field of the previous reference object via an Object property value resolver. However, any other value resolver can be used instead to define the alternative reference object with which to evaluate within the rules configured using the With rule.
If rules within the With rule are to include the previous reference object in addition to the alternative reference object, the Original entity name parameter must be used. This names a variable via which rules can access the previous reference object within the With rule.
►NOTE◄ The With rule can be used in cascade to override the alternative reference object in stages. In each stage of a cascade, there is access to the reference objects of the parent stages, provided that different variable names are used in the Original entity name parameter.
Configuration
The optional Entity property resolver parameter defines a value resolver for the alternative reference object. At runtime, this determines the value of the entity variable in the context of the rules configured within With rule.
The optional Original entity name parameter specifies the name of a variable to which the previous reference object is (temporarily) assigned as a value for the context of the rules configured within the With rule .
The
|
|
Example
The objective in this example is to evaluate within an association criterion, whether the country code (see Country) of a company account address belongs to a set of 'zones' across several countries.
Mappings from country codes to zones are defined by other association criteria, which should be referred to as Sub criterion rule. Each sub criterion runs a Check type for an entity type 'Address' (see Addresses) and matches the contained country code (countryCode) against a specific whitelist.
In the specific case, the company address is to be matched with the sub-criteria for the zones 'APAC' (Asia/Pacific) and 'LATAM' (Latin America), that check the countryCode property against a static white list of Country values generate by a Create list resolver.
Configuration
The original reference object (above the With rule) should be a Company value (not shown in the screenshot), which could be resolved e.g. as Company of session or from a company attribute of a business object (see Business objects and attributes).
In this case, the Object property value resolver in the With rule refers to the address (in the address field) of the previous reference object (company) as an alternative reference object, since every single Sub criterion rule expects the entity type 'address' as a reference object.
The initial reference object (company) is assigned to the variable company via Original entity name. In the example, the existing rules within the With rule do not access this variable. However, additional rules could be added that require this access.