# 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:

<table data-header-hidden><thead><tr><th width="315" valign="top">Property</th><th>Description</th></tr></thead><tbody><tr><td valign="top">Property</td><td>Description</td></tr><tr><td valign="top"><code>CASE.case_number</code></td><td>The case number in the user readable format, e.g. <code>CSE-1991</code>.</td></tr><tr><td valign="top"><code>CASE.process_key</code></td><td>The key of the process the <a href="../../guides/glossary/case">case</a> is based on, e.g. <code>end_to_end_onboarding</code>.</td></tr><tr><td valign="top"><code>CASE.process_name</code></td><td>The translated name of the <a href="../../guides/glossary/process">process</a> the case is based on, e.g. <code>End to End Onboarding</code>. <br><br><strong>Note:</strong> 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 <code>process_key</code> for such comparisons.</td></tr><tr><td valign="top"><code>CASE.outcome_instance</code></td><td>The outcome <a href="../../guides/glossary/instance">instance</a> this case operates on. For a case creating a new contract this is often <code>ContractualRelationship</code>.</td></tr><tr><td valign="top"><code>CASE.state</code></td><td>The <em>key</em> of the current state the case is in, e.g. <code>draft</code>.</td></tr><tr><td valign="top"><code>CASE.all_states</code></td><td>All possible states the case could be in according to the workflow of the process. </td></tr><tr><td valign="top"><code>CASE.states_history</code></td><td><p>Returns a dictionary with some statistical information about each state. This includes:</p><ul><li><code>initiator</code> (the last one)</li><li><code>entered</code> (when was this state entered last)</li><li><code>days</code> (Total days in state, so the time in days the case was in this state every time it entered)</li><li><code>times_entered</code> (how many times the case entered this state)</li><li><code>previous_state</code> (the last one)</li></ul></td></tr><tr><td valign="top"><code>CASE.last_transition</code></td><td>The <em>key</em> of the last transition (if any) that was done to arrive at the current state, e.g. <code>back_to_draft</code>.</td></tr><tr><td valign="top"><code>CASE.last_transition_at</code></td><td>The time when the last transition (if any) happened, e.g. <code>2022-11-17 11:05:30.322951</code></td></tr><tr><td valign="top"><code>CASE.last_transition_by</code></td><td>The username of the user that performed the last transition</td></tr><tr><td valign="top"><code>CASE.last_transition_by_name</code></td><td>The name of the user that performed the last transition</td></tr><tr><td valign="top"><code>CASE.number_of_missing_information</code></td><td>How many information still should be provided (the sum of all the grey bubbles on information tabs).</td></tr><tr><td valign="top"><code>CASE.number_of_tasks</code></td><td>Current number of tasks within the case.</td></tr><tr><td valign="top"><code>CASE.number_of_issues</code></td><td>Current number of issues within the case.</td></tr><tr><td valign="top"><code>CASE.created_at</code></td><td>The time when the case was created, e.g. <code>2021-11-30 16:40:12.923654</code></td></tr><tr><td valign="top"><code>CASE.last_update</code></td><td>The last time the case was updates, e.g. <code>2021-03-12 11:58:08.644664</code>.</td></tr><tr><td valign="top"><code>CASE.owner</code></td><td>The owner of the case (the email in rules and the full name and email when printed)</td></tr><tr><td valign="top"><code>CASE.owner_name</code></td><td>The full name of the case owner</td></tr><tr><td valign="top"><code>CASE.owner_groups</code></td><td>A list of the names of the groups the current case owner has.</td></tr><tr><td valign="top"><code>CASE.owner_roles</code></td><td>A list of the names of the roles the current case owner has.</td></tr><tr><td valign="top"><code>CASE.initiator</code></td><td>The initiator of the case (the email in rules and the full name and email when printed)</td></tr><tr><td valign="top"><code>CASE.initiator_name</code></td><td>The full name of the case initiator</td></tr><tr><td valign="top"><code>CASE.assignee</code></td><td>The assignee to the case (the email in rules and the full name and email when printed)</td></tr><tr><td valign="top"><code>CASE.assignee_name</code></td><td>The full name of the case owner</td></tr><tr><td valign="top"><code>CASE.approver</code></td><td>The user (if any) who approved the case (the email in rules and the full name and email when printed)</td></tr><tr><td valign="top"><code>CASE.approver_name</code></td><td>The full name of the case approver</td></tr><tr><td valign="top"><code>CASE.documents</code></td><td>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.</td></tr><tr><td valign="top"><code>CASE.proofs</code></td><td>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.</td></tr><tr><td valign="top"><code>CASE.comments</code></td><td><p>A list of dictionaries about all the comments in a case. Each dictionaries contains these keys:<br></p><ul><li><strong><code>creation_date</code></strong> - ISO 8601 timestamp when the comment was created (string or null)</li><li><strong><code>edit_date</code></strong> - ISO 8601 timestamp when the comment was last edited (string or null)</li><li><strong><code>author</code></strong> - Name of the user who created the comment (string or null)</li><li><strong><code>assignee</code></strong> - Name of the user assigned to the comment/task (string or null)</li><li><strong><code>text</code></strong> - The comment text content (string or null)</li><li><strong><code>is_issue</code></strong> - Whether the comment is marked as an issue (boolean)</li><li><strong><code>is_resolved</code></strong> - Whether the issue has been resolved (boolean)</li><li><strong><code>resolved_by</code></strong> - Name of the user who resolved the issue (string or null)</li><li><strong><code>is_archived</code></strong> - Whether the comment is archived (boolean)</li><li><strong><code>archived_by</code></strong> - Name of the user who archived the comment (string or null)</li><li><strong><code>deadline</code></strong> - ISO 8601 timestamp for the task deadline (string or null)</li><li><strong><code>referenced_instance</code></strong> - ID of the instance the comment refers to (integer or null)</li><li><strong><code>referenced_information_key</code></strong> - Key of the information field the comment refers to (string or null)</li><li><strong><code>referenced_readable</code></strong> - Human-readable reference, e.g., "Person 66" or "John Doe / street_and_number" (string or null)</li><li><strong><code>is_warning</code></strong> - Whether the comment is a warning (boolean)</li><li><strong><code>title</code></strong> - Title of the comment, if from a rule with a title translation (string, optional)</li><li><strong><code>replies</code></strong> - List of reply comment dictionaries with the same structure (array, only present if comment has replies)</li></ul></td></tr></tbody></table>

### 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".&#x20;

Please note that 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).&#x20;
