Dear all,
I cannot trigger a task, my tasks.js
seems to be the problem.
I am running a form at a place
. The form-id is young_infant
.
It has a calculate field d_after_lab_task
, that generates a number.
If d_after_lab_task
is equal to 1
I want the tast to be triggered.
The task would start another form with the form-id young_infant_afterlab
, again at the facility level, at the same facility.
I run the flow but no task is triggered.
The relevant part of my task.js
file is
{
name: 'young_infant_afterlab',
icon: 'icon-followup-general',
title: 'YI continue after lab',
appliesTo: 'reports',
appliesToType: ['young_infant'],
appliesIf: function(contact, report) {
return report && getField(report, 'd_after_lab_task') === '1';
},
actions: [
{
type: 'report',
form: 'young_infant_afterlab',
modifyContent: function (content, contact, report) {
content.d_vsd = getField(report, 'd_vsd');
content.d_malaria_severe = getField(report, 'd_malaria_severe');
content.d_infection_syphilis_unlikely = getField(report, 'd_infection_syphilis_unlikely');
content.d_delay_developmental_suspected = getField(report, 'd_delay_developmental_suspected');
}
}
],
events: [
{
id: 'young_infant_afterlab',
days: 0,
start: 2,
end: 7
}
],
resolvedIf: function(contact, report, event, dueDate) {
const startTime = Math.max(addDays(dueDate, -event.start).getTime(), report.reported_date);
const endTime = addDays(dueDate, event.end + 1).getTime();
return isFormArraySubmittedInWindow(
contact.reports, ['young_infant_afterlab'], startTime, endTime
);
}
},
I have checked the reports
, the trigger variable is 1
, so it is not a problem with the initial form.