Triggering a task follow-up

Hello @diana @samuel

I am implementing some workflow below

where by when i initially fill out the Appointment form and select the viral load option, the Viral load lab test results task is triggered however the challenge am facing is when i select the unknown option during the process of selecting the result in the Viral load lab test results form , the opening up of the New Appointment task again fails to show up.
How can i get the appointment form to open up again when the Unknown option is selected as seen in the screen shot above …
Below is my configuration code for triggering …

    name: 'new-appointment-task-cd4a',
    title: 'New Appointment',
    icon: 'assessment',
    appliesTo: 'reports',
    appliesToType: ['lab'],
    appliesIf: function(r){
      return getField(r, 'appoint_this') === 'snooze1';
    actions: [{ form: 'appointment', }],
    events: [{
      start: 1,
      days: 1,
      end: 1,
    resolvedIf: function(c, r, event, dueDate) {
      // Resolved if there is appointment received in time window
      return isFormFromArraySubmittedInWindow(c.reports, 'appointment',
                 Utils.addDate(dueDate, -event.start).getTime(),
                 Utils.addDate(dueDate,  event.end+1).getTime());              

Hello @cliff!

the opening up of the New Appointment task again fails to show up

I have a couple of thoughts about what might be causing this to fail.

  1. The appliesIf function is not resolving true when the lab results are unknown. Without knowing the details of the lab form, I am not sure if the check for the appoint_this field is correct or not for this case. If the appliesIf function returns false, though, you will not have a new appointment task triggered.
  2. the other thing we need to watch out for is probably the resolvedIf function. If I understand your workflow correctly, it can go appointment > lab > appointment. However, your current configuration for the resolvedIf function looks like it is just checking for an appointment form that has been submitted within a given window. If that first appointment form happens to fall within that window, then I think this task will never be displayed to the user in that case since it will already be “resolved”. You may have to update the resolvedIf check to make sure it cannot return a false positive based on the first appointment form.
1 Like