__other_cases¶
Info
New in Atfinity 18.
Description¶
__other_cases lists the other cases an instance is in,
in any status, newest first.
Every instance has it, and a rule can read it but not assign it.
The case the rule runs in is not in the list, because its data is already on
CASE, where it is always up to date.
Draft cases are not in the list of a live case.
In a draft case, the list holds the other draft cases with a copy of the same instance.
In a manual instance action or a
scheduled rule on an instance there is no current case, so the list holds every
case of the instance.
An instance created in the current run of the rules is in no other case yet, so its list is empty.
Each entry is a dictionary you read with a dot, as in c.process_key:
| Key | Content |
|---|---|
id |
The number of the case, as CASE.case_id |
case_number |
The case number, as CASE.case_number, e.g. CSE-5110 |
process_key |
The key of the process the case is based on, as CASE.process_key |
state |
The key of the state the case is in, as CASE.state |
status |
ONGOING, APPROVED or DECLINED |
roles |
The keys of the roles the instance has in that case, a list that is empty if it has none |
is_outcome |
true if the instance is the outcome instance of that case |
created_at |
When the case was created, as CASE.created_at |
last_transition_at |
When the case last moved to another state, as CASE.last_transition_at, unknown if it never did |
The names of the process and of the case are not in the entry, so compare process_key rather than a translated name.
Neither are the values entered in the other case.
The list is read when the rules of the case run. A change in another case, such as its approval, shows up the next time the rules of this case run.
Example: Counting contracts¶
p is Person
---
p.number_of_contracts := count(p.__other_cases.filter(c => c.process_key = 'contract_opening'))
This counts the other contract opening cases of the person, whether they are ongoing, approved or declined.
Example: Open cases where the person signs¶
p is Person
p.__other_cases.filter(c => c.status = 'ONGOING' and 'AuthorisedSignatory' in c.roles).map(c => c.case_number)
This gives the case numbers of the open cases in which the person has the role AuthorisedSignatory.
Example: Outcome of an open case¶
c is Contract
count(c.__other_cases.filter(other => other.is_outcome and other.status = 'ONGOING')) > 0
This is true while another open case is set up to produce this contract as its outcome, for example to stop the same account being opened twice.
To see which other ongoing cases a reviewer is shown, and how values approved in them are flagged, read Instances used in multiple cases.