Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(#737): add more details about input data for task forms #1774

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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