Search code examples
django-viewflow

Django Viewflow with custom views - start different flows, depending on user selection in the first screen


I have a view with StartFlowMixin, it contains a form - user posts the form and a workflow starts. That works fine currently, but I need to introduce a dropdown in the form with 4 options - based on the selection in that dropdown I need to run a different flow.

E.g. the dropdown contains options like Apply for position A, Apply for position B, etc. Based on the selection the applicant needs to enter different information and different people need to approve the application.

How can I do this? One option would be to have a single workflow with a lot of ifs, but I don't like that.


Solution

  • The core of the BPMN approach for business process modeling is to record every user's decisions.

    You could use flow.Switch for that case - http://docs.viewflow.io/viewflow_core_node.html#viewflow.nodes.Switch

    Or you could use your own view, that would call required flow.StartFunction, to start actual flow - http://docs.viewflow.io/viewflow_core_node.html#viewflow.nodes.StartFunction