Multiexcerpt include macro | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Table of Contents |
---|
Overview
This feature allows users with Edit Data access (see CommCareHQ Web Users) to configure updates to cases, including the ability to close cases. Without this feature, the only ways to close cases are by filling out a form that closes a case, finding the case in the Case List and manually using the Close Case button, or by using the Case Importer tool.
Note that automatic update rules will only trigger on cases that are currently open. If a case has already been closed, it will not be updated by a rule, even if it otherwise matches the filter criteria.
Table of Contents |
---|
When should you automatically update cases?
Here are some examples of when this is useful:
...
For example, imagine that you want to close any "Patient" cases which have not been updated in a year. You want to do this to reduce the caseload on the users' phones and to keep the reports accurate.
You can create a rule by navigating to Data → Automatically Update Cases → + Add Automatic Case Update Rule button:
Fill out the basic information by giving the rule a name you can use to remember what it's for:
...
Choose the "Case Type" and "Run when". "ALL of the criteria are met" works when you want to apply all your filter criteria. "ANY of the criteria are met" works only when you want ANY of the filter criteria to apply in the Auto Update Cases.
...
Next, add your filter criteria which define the cases that the rule will apply to. Notice that the wording "AND" "OR" next to the rule filter changes with the button.
When selecting the Case Property filter, a data list will be displayed as you begin typing. This will search the applications Data Dictionary, and allow you to select the relevant Case Property.
Notes:
Projects without the Data Dictionary flag will see a plain text field instead of a data list.
The field will also accept free text if the Data Dictionary is out-of-date.
The data list only retrieves project-defined case properties, from the Data Dictionary. The list will not contain System Properties, but this will be added at a future date.
And lastly, specify the actions that will be applied to the cases that match these criteria. These actions say to close the case and update case property "close_reason", setting it to the value "automatic" and save.
...
Case Filter Criteria
The following filter criteria are available for matching cases:
...
In addition to the dynamic case properties created by your app(s), you can reference the following case properties in automatic update rule criteria:
Case Property | Description |
---|---|
name | The case's name |
owner_id | The system identifier for the case's owner |
opened_on | The timestamp that the case was opened |
opened_by | The system identifier for the case's opener |
modified_on | The timestamp that the case was last modified on mobile |
server_modified_on | The timestamp that the case was last modified on the server |
external_id | An optional external id your app may assign to the case |
Parent cases may also be referenced in the automatic update rule criteria by prefixing the property name with "parent/". So, for example, parent/name references the parent case's name.
...