Can Frappe workflow be defined based on DocType field values?

Hi Team,
Currently workflow is assigned to a DocType and all objects of that DocType has the same workflow. What I am looking for if there’s way to use field value to decide which workflow to use.

For example there’s a type field associated with DocType and based on the type field values DocType can have different workflow instead of having static workflow.

It’s possible, but not exactly as you’ve described it. You can’t switch between workflows, at least not without some heavy duty scripting, but you can have unlimited states and unlimited actions in each workflow. You can make certain actions available only conditionally, which will allow you to direct the workflow based on document values. Check the details button on each action row to see where conditions can be added.

Thank you for the response appreciate it.
Suggested workaround looks workable but IMHO it will be maintenance nightmare. I am looking at something which can help to logically separate the workflows. Any thoughts on that if that can be done or not ?

Not really. You could design your own workflow mechanisms using client scripts and custom doctypes, but that’d be a lot of work.

In the past, people have discussed adding some sort of visual builder to the workflow document. It’d be nice, but I don’t think anyone has found the possibility useful enough to put the time in. At my organization, I’ve just used Vizio or something similar to draw up the diagram then translate it in. Even with relatively complicated flows, it’s been pretty straightforward to translate. If you’re talking about hundreds of stages/actions, you probably want to consider a proper orchestration engine.

1 Like

Thank you this is really helpful to get sense if something like this is possible within framework boundaries

It’s actually not about hundreds of stages/actions its about giving flexibility to different teams to manage their own workflows.

Your input has been really helpful , will wait and see if there are any better suggestions coming.

Ah, interesting. Nothing like that is available right now, as I think the current design assumes that workflows will be designed by the System Manager, but what you’re describing has a real use case.

maybe you can refer to this not merged pr for ideas how it can be done by heavy customizing

1 Like

Thanks I will check it out.

I looked at the solution looks promising, how do we ensure compatibility with newer releases as I see the PR is not merged yet nor do I see any plans to do it . Are you using it in production environment ?

no real customer, not fully tested. no plan to proceed further. only for reference.