Is it possible to automatically trigger or open a next form in a flow directly after submitting the previous form, without requiring the user to click on the next form/task explicitly?
No, I do not think that this is supported by the CHT. I have moved this thread to the #product group, though, as this is an interesting feature request! It would be great if you could share more details about the workflow challenges you are trying to address (and particularly how the the current tasks functionality does not meet your needs).
As a technical note, I do not think it would be very difficult to include this functionality in the CHT. The hard part would be to determine how to configure which new forms to trigger when a report is submitted…
Just wanted to also include some additional context from the broader ODK ecosystm. That thread raises some additional questions/features that should be considered (e.g. passing data to the new forms). Though, it is worth noting that the feedback from the ODK team on the thread was basically to propose using a single large form instead of triggering multiple smaller forms in sequence…
Thank you for your answer. We are currently trying to find a solution for a parallel flow which only gets triggered depending on a form output variable. In order for a smoother process, we thought it would be optimal if we could then trigger and open the first form of the parallel flow automatically when the criteria is met.
I have been experimenting with the “instance::db-doc” column to generate pull other form from a form.
initially I though this would start the subform in the form filler (enketo) but it seams it only create a fake submission, the docs seems to confirm Creating Additional Docs from App Forms | Community Health Toolkit) ?
I read here that there is no solution but I think I won’t be the only one needing it
Here some use cases:
- immunization have some complex skip logic, other questionnaire will benefit of starting it without copy/pasting the questions
- complex questionnaire (we are reaching 2000 lines on the xlsx) are slow, they will would benefit of being sliced up
- sometime a questionnaire follows directly another questionnaire but other time a task will be created for the second questionnaire to be done later in case like out of stock or time consuming activity required etc (duplication of the questions make it difficult to maintain)
regarding the question “e.g. passing data to the new forms”
I think having an “inputs” group on the same level as the “instance::db-doc” could fake the task approach
Similar post:
- How to transition to next form automatically → here the extra doc is mentioned but, looking at the xlsx it seems that the questions were duplicated
- Autostart tasks after an initial form to ensure seamless user experience → using task could be a solution if it could start automatically
@jkuester as a workarround can you use the react router in the task.js ?
Hmm not sure what you mean by “react router”? Generally speaking, the only external context available to the task.js is what is documented here.
That being said, the extension-libs might be of particular interest to you! As of yet I have not been able to come up with a way to use it to help model sequential forms but it is pretty open-ended and there might be something there (especially since I believe you could reference window.PouchDB
from that code and have direct access to the database (something that we would, of course, not recommend and would void all warrenties, etc etc…).
On a related note, how much difference do you think it would make if we expanded the contact selector functionality to also be able to load arbitrary data_record
docs into the form? It seems like that would open a lot of opportunities for injecting data. The catch would be that you would have to have the exact id of the doc to load (since open-ended queries could get really bad). But it seems like you could have the id stored in the contact-summary and then use that to load the doc…
I meant angular router (I use react router in another project) : CHT core seems to rely on angular router to open new page (such as the page to fill task form) , usually the route call is trigger by a button on the UI but we should be able to call it from a function.
My initial idea was that in the tasks.js, once the data is loaded into the task (modifyContent function) we “could” ask the router to go directly the page to fill task form, instead of the normal behavior. Of course only one task could to that at a given time
I checked the code and I don’t think we can just call the router in tasks.js (I will give it a try but it can mess with other process that should happen after modifyContent )
so I think the simplest will be to add a fields “jumpTo” (task, tasklist, contact etc … ) on the task schema and use the router in the cht Core part that manage the tasks.
br
thanks for the links,
extension-libs will help for sure when it comes to more complex calculation such as drug dosage
for the load data, I think the modifycontext in the contact-summary works very well but maybe too complex for the less IT community members
br