Skip to content

CASE

From RuLa, you can access certain information about the case itself. For this, within applicable rules, you have access to the constant CASE like to any other instance. On this instance, the following information is available:

Property Description
Property Description
CASE.case_number The case number in the user readable format, e.g. CSE-1991.
CASE.process_key The key of the process the case is based on, e.g. end_to_end_onboarding.
CASE.process_name The translated name of the process the case is based on, e.g. End to End Onboarding.

Note: This will be translated on documents and in the case manager. Within rules, it's just a placeholder, so e.g. `CASE.process_name = 'Onboarding'` will not work. Use process_key for such comparisons.
CASE.outcome_instance The outcome instance this case operates on. For a case creating a new contract this is often ContractualRelationship.
CASE.state The key of the current state the case is in, e.g. draft.
CASE.all_states All possible states the case could be in according to the workflow of the process.
CASE.states_history

Returns a dictionary with some statistical information about each state. This includes:

  • initiator (the last one)
  • entered (when was this state entered last)
  • days (Total days in state, so the time in days the case was in this state every time it entered)
  • times_entered (how many times the case entered this state)
  • previous_state (the last one)
CASE.last_transition The key of the last transition (if any) that was done to arrive at the current state, e.g. back_to_draft.
CASE.last_transition_at The time when the last transition (if any) happened, e.g. 2022-11-17 11:05:30.322951
CASE.last_transition_by The username of the user that performed the last transition
CASE.last_transition_by_name The name of the user that performed the last transition
CASE.number_of_missing_information How many information still should be provided (the sum of all the grey bubbles on information tabs).
CASE.number_of_tasks Current number of tasks within the case.
CASE.number_of_issues Current number of issues within the case.
CASE.created_at The time when the case was created, e.g. 2021-11-30 16:40:12.923654
CASE.last_update The last time the case was updates, e.g. 2021-03-12 11:58:08.644664.
CASE.owner The owner of the case (the email in rules and the full name and email when printed)
CASE.owner_name The full name of the case owner
CASE.owner_groups A list of the names of the groups the current case owner has.
CASE.owner_roles A list of the names of the roles the current case owner has.
CASE.initiator The initiator of the case (the email in rules and the full name and email when printed)
CASE.initiator_name The full name of the case initiator
CASE.assignee The assignee to the case (the email in rules and the full name and email when printed)
CASE.assignee_name The full name of the case owner
CASE.approver The user (if any) who approved the case (the email in rules and the full name and email when printed)
CASE.approver_name The full name of the case approver
CASE.documents A list with the names of all documents that are used in a case. This can be used to e.g. create a customised table of contents.
CASE.documents_by_key (new in Atfinity 17) A dictionary from a document's key to the document itself.
CASE.booklets_by_key (new in Atfinity 17) A dictionary from a booklet's key to the booklet itself.
CASE.proofs A list with the names of all proofs that are used in a case. This can be used to e.g. create a customised table of contents.
CASE.comments

A list of dictionaries about all the comments in a case. Each dictionaries contains these keys:

  • creation_date - ISO 8601 timestamp when the comment was created (string or null)
  • edit_date - ISO 8601 timestamp when the comment was last edited (string or null)
  • author - Name of the user who created the comment (string or null)
  • assignee - Name of the user assigned to the comment/task (string or null)
  • text - The comment text content (string or null)
  • is_issue - Whether the comment is marked as an issue (boolean)
  • is_resolved - Whether the issue has been resolved (boolean)
  • resolved_by - Name of the user who resolved the issue (string or null)
  • is_archived - Whether the comment is archived (boolean)
  • archived_by - Name of the user who archived the comment (string or null)
  • deadline - ISO 8601 timestamp for the task deadline (string or null)
  • referenced_instance - ID of the instance the comment refers to (integer or null)
  • referenced_information_key - Key of the information field the comment refers to (string or null)
  • referenced_readable - Human-readable reference, e.g., "Person 66" or "John Doe / street_and_number" (string or null)
  • is_warning - Whether the comment is a warning (boolean)
  • title - Title of the comment, if from a rule with a title translation (string, optional)
  • replies - List of reply comment dictionaries with the same structure (array, only present if comment has replies)
CASE.is_first_rule_engine_run (new in Atfinity 17) Whether the case is currently in its very first evaluation, so before any rule has been applied to it. Useful to give a case starting values once. Existing cases created before this became available report false.
CASE.num_active_wizards (new in Atfinity 17) The number of wizards on the case that a user can still fill in and submit, i.e. those in status created or opened.
CASE.wizards (new in Atfinity 17)

A list of dictionaries about all wizards on the case, in any status. Each dictionary contains these keys:

  • status - The wizard status: created, opened, completed or inactive (string)
  • type - The wizard type: creation, ongoing_instances or ongoing_whole_case (string)
  • created - ISO 8601 timestamp when the wizard was created (string)
  • updated - ISO 8601 timestamp when the wizard was last updated (string)
  • wizard_template_uuid - The external UUID of the wizard template the wizard is based on (string or null)
  • email - The email address the wizard was created for (string)
  • opened_on - ISO 8601 timestamp when the wizard was first opened (string or null)
CASE.cross_case_usage_by_instance_id (new in Atfinity 17)

A dictionary keyed by the id (as a string) of every instance in the case that is also linked into another ongoing case, or has a pending value warning. Each entry contains:

  • cases - the other ongoing cases sharing the instance, each with source_case_id, source_case_process_key and source_case_state_key
  • warning - null, or a dictionary with id, source_case_id (null if the values were changed outside of any case), source_case_process_key, instance_name, values_overwritten and timestamp
CASE.number_of_instance_warnings (new in Atfinity 17) The number of instances in the case that currently have a pending value warning.
CASE.signature_links (new in Atfinity 17)

A list of dictionaries about every signature request on the case, in any status, newest first. Each dictionary contains these keys:

  • url - The link the signatory follows to sign, unknown when the request has none (string)
  • signatory_name - The name the request was created for (string)
  • signatory_email - The email address the request was created for (string)
  • signatory_phone_number - unknown when the signatory has none (string)
  • status - IN_PROGRESS, COMPLETED, DECLINED or REVOKED, taken across all the documents in the request (string)
  • created - ISO 8601 timestamp when the request was created (string)
  • booklet - The key of the booklet the request was sent from, unknown for a request sent from a single document, a proof or a field file (string)
  • documents - The keys of the documents the signatory signs in this request (list of strings)
  • information - The keys of the information fields whose files the signatory signs in this request (list of strings)

A signatory sent two separate requests appears twice, so filter by booklet, documents or information when a signatory can hold more than one link at a time.

CASE.ai_case_problems (new in Atfinity 17)

A list of dictionaries about the problems the AI Case Checks on the case currently report, newest first. A problem a user ignored, a problem below the minimum confidence, and a problem whose check no longer matches the case are all left out, so the list holds what the case wizard shows once the current evaluation is saved. Each dictionary contains these keys:

  • key - The key of the AI Case Check that reported the problem (string)
  • title - The translated title of the check (string)
  • severity - very_low, low, medium, high or very_high (string)
  • severity_rank - The same severity as a number from 1 to 5, so that it can be compared (integer)
  • confidence - How confident the assessment is, from 50 to 95 (integer)
  • description - The reason the AI gave (string)
  • instance_ids - The ids of the instances the check matched (list of integers)
CASE.ai_case_problems_by_key (new in Atfinity 17) A dictionary from an AI Case Check's key to the problems that check reports. Every check on the case's process has an entry, so a check that found nothing gives an empty list rather than unknown.
CASE.number_of_ai_case_problems (new in Atfinity 17) The number of problems in CASE.ai_case_problems.
CASE.pending_ai_case_check_keys (new in Atfinity 17) The keys of the AI Case Checks whose result is not in yet, either because they have never run or because the case data behind them changed and they are running again. Their previous result still counts towards CASE.ai_case_problems until the new one arrives.
CASE.number_of_pending_ai_case_checks (new in Atfinity 17) The number of keys in CASE.pending_ai_case_check_keys.

Example: CASE.number_of_issues

CASE.number_of_issues = 0 and CASE.number_of_tasks = 0

This rule will only be fulfilled when there are no issues or tasks within a case.

Example: CASE.state

CASE.state = 'draft'

This rule would only be fulfilled while the case is in the state with the key '"draft".

If you are using this to create an issue or comment, it would be, as any other issue, comment or warning, removed when the case leaves that state (unless a user replied to it or was assigned to it).

Example: CASE.num_active_wizards

CASE.num_active_wizards = 0

This rule is only fulfilled when there are no wizards left that a user can still fill in and submit.

Example: CASE.wizards

You can use CASE.wizards together with the list operators to reason about individual wizards, for example counting the wizards that have already been submitted:

count(CASE.wizards.filter(wizard => wizard.status = 'completed'))

Filter the list down to the signatory you are writing the rule for, and take the first element to get their current request:

FIRST_ELEMENT(CASE.signature_links.filter(link => link.signatory_email = p.email)).url

Together with a Send Email action this sends a signatory their signing link. The link belongs in the body of the action rather than in an email template, because a template cannot reach case data.