Skip to content

Commit

Permalink
feat(#737): add more details about input data for task forms (#1774)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuester authored Feb 18, 2025
1 parent 66f504e commit cc389c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions content/en/building/forms/configuring/form-inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ Contact summary data is not available in `contact` forms or in forms created fro

`app` forms created via a task have access to any data [supplied by the task]({{< ref "building/tasks/managing-tasks/pass-data-to-form" >}}) in the `inputs` group.

Additionally, these forms have access to the [contact data]({{< ref "#inputs-data-for-contact-in-app-forms" >}}) for the contact associated with the task.

The following fields will also be available in the `inputs` group:

- `task_id`: The unique identifier of the task in context.
- `source_id`: For tasks with `appliesTo: 'contacts`, this is the id of the contact for the task. For tasks with `appliesTo: 'reports'`, this is the id of the report which triggered the task.

---

## `user` data
Expand Down
2 changes: 1 addition & 1 deletion content/en/building/tasks/tasks-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Task generation occurs on the client periodically and creates documents which tr
| `title` | `translation key` | The title of the task (labeled above). | yes |
| `appliesTo` | `'contacts'` or `'reports'` | Do you want to emit one task per report, or one task per contact? See [Understanding the Parameters in the Task Schema]({{< ref "building/tasks/managing-tasks/task-schema-parameters.md" >}}). | yes |
| `appliesIf` | `function(contact, report)` | If `appliesTo: 'contacts'`, this function is invoked once per contact and `report` is undefined. If `appliesTo: 'reports'`, this function is invoked once per report. Return true if the task should appear for the given documents. See [Understanding the Parameters in the Task Schema]({{< ref "building/tasks/managing-tasks/task-schema-parameters.md" >}}). | no |
| `appliesToType` | `string[]` | Filters the contacts or reports for which `appliesIf` will be evaluated. If `appliesTo: 'reports'`, this is an array of form codes. If `appliesTo: 'contacts'`, this is an array of contact types. For example, `['person']` or `['clinic', 'health_center']`. For example, `['pregnancy']` or `['P', 'pregnancy']`. See [Understanding the Parameters in the Task Schema]({{< ref "building/tasks/managing-tasks/task-schema-parameters.md" >}}). | no |
| `appliesToType` | `string[]` | Filters the contacts or reports for which `appliesIf` will be evaluated. If `appliesTo: 'reports'`, this is an array of form codes. For example, `['pregnancy']` or `['P', 'pregnancy']`. If `appliesTo: 'contacts'`, this is an array of contact types. For example, `['person']` or `['clinic', 'health_center']`. See [Understanding the Parameters in the Task Schema]({{< ref "building/tasks/managing-tasks/task-schema-parameters.md" >}}). | no |
| `contactLabel` | `string` or `function(contact, report)` | Controls the label describing the subject of the task. Defaults to the name of the contact (`contact.contact.name`). | no |
| `resolvedIf` | `function(contact, report, event, dueDate)` | Return true to mark the task as "resolved". A resolved task uses memory on the phone, but is not displayed. | no, if any `actions[n].type` is `'report'` |
| `events` | `object[]` | An event is used to specify the timing of the task. | yes |
Expand Down

0 comments on commit cc389c4

Please sign in to comment.