From 1518ae7d58c05dac97b8bcb45c8a8f973121e547 Mon Sep 17 00:00:00 2001 From: Joshua Kuestersteffen Date: Fri, 14 Feb 2025 12:56:57 -0600 Subject: [PATCH] feat(#737): add more details about input data for task forms --- content/en/building/forms/configuring/form-inputs.md | 7 +++++++ content/en/building/tasks/tasks-js.md | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/content/en/building/forms/configuring/form-inputs.md b/content/en/building/forms/configuring/form-inputs.md index 42dc8ea3b..e01c3f391 100644 --- a/content/en/building/forms/configuring/form-inputs.md +++ b/content/en/building/forms/configuring/form-inputs.md @@ -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 diff --git a/content/en/building/tasks/tasks-js.md b/content/en/building/tasks/tasks-js.md index b08892019..2402168d8 100644 --- a/content/en/building/tasks/tasks-js.md +++ b/content/en/building/tasks/tasks-js.md @@ -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 |