Not being able to view tasks

Hi team, I am following documentation on Building a Simple Task but I have not been able to create tasks after form submission. I do not see any error so it is difficult to understand what I may be missing. Could someone please advise? I have attached the code from tasks.js below:

module.exports = [{
  name: 'assessment-after-submission',
  title: 'First Assessment',
  icon: 'icon-healthcare',
  appliesTo: 'reports',
  appliesToType: ['child_health_assesment'],
  actions: [{ form: 'follow_up_child_health_form'}],
  events: [{
    start: 7,
    days: 7,
    end: 2,
  }]
}];

This has to do with task windows. Given your code, the task windows starts 7 days before the reported date, and ends 2 days after the reported date. Given you have not specified a custom resolvedIf logic, we’ll use the default resolvedIf implementation which would check for a submitted follow_up_child_health_form form within the specified task window.

As currently implemented, you would only be able to trigger a task if the child_health_assesment assessment form is submitted 3 days after the previous follow_up_child_health_form submission.

To get around this, you would need to define a custom resolvedIf function that utilises a custom implementation of Utils.isFormSubmittedInWindow that checks whether the report triggering the task has a corresponding / linked follow up. An example of how this has been implemented can be seen on the open source PIH Malawi App here and here

2 Likes