How can I setup multiple workflows for same document type Or doctype?

Hello everyone.

How can I setup multiple workflows for the Same document type Or doctype?

Please I need someone to help me on this.

Hi there,
Only one workflow can be active for a doctype at a given time. That said, a single workflow can have multiple parallel paths, even with no overlap or intersection, so it is possible to have multiple “sub-” workflows within a single workflow definition.

Thanks for your response @peterg I really appreciate. Please can you give me a guide on how to do multiple “Sub-” workflows within a single workflow?

Thanks for your response @peterg I really appreciate. Please can you give me a guide on how to do multiple “Sub-” workflows within a single workflow?

In a workflow, you’re allowed to have as many states and as many transitions as you want. The transitions don’t even need to connect to each other. Typically, you would make different workflows available to different kinds of users or in response to different document parameters. There’s no trick to it; you just need to map out all of the states and pathways that you need for different workflows, set conditions to ensure that actions appear only when they’re supposed to, and activate.

If that’s not sufficiently clear to help you, you might consider posting your desired workflow in detail. It would be easier to describe with specifics.

Thank you very much.
Let me try that.

Thank you very much @peterg
Let me try that.

please monitor this pending PR feat: Document workflow by ascratech · Pull Request #15952 · frappe/frappe · GitHub

Thank you very much @peterg

Below is the detail workflow:

We have 2 sets of groups of people that are doing the approval of both the Material Request and Material issue.

For Material Request approval, Below are the people that are in charge of the approval:
(1) Project Manager
(2) Procurement Officer
(3) Store Keeper.

For Material Issue approval, Below are the people that are in charge of the approval:
(1) Store Manager
(2) Managing Director.

Please can you guide me on how to use the same Workflow for both Material request and Material issue approval?

          OR

Please can you guide me on how the same Workflow can be branched?.

Thank you.

This is a different question from what you were asking before, no? Before you were asking how to combine two different workflows for one doctype, and now you’re asking how to use the same workflow for different doctypes?

There’s no way to use the same workflow for two different doctypes, but you can duplicate an existing doctype and change the doctype it applies to.

Thank you very much @peterg.
I really appreciate.

Please what is the name of the Material issue doctype?

Thank you very much @peterg.
I really appreciate.

Please what is the name of the Material issue doctype?

@peterg thanks for helping above. Just wanted to confirm, suppose I have 2 non-overlapping workflows, how do I maintain different states for both?

ex - for a doctype vmsTrip,

suppose for some parameter as payment_type is advanced, I want to create a parallel workflow without effecting the main workflow.

But issue is - the status of doc will be a single value right? i.e the workflow_state.

Hi there,

It is not possible for a document to have multiple Workflow states simultaneously. You can build complex pathways differentiated by roles and parameters, but a given document always has exactly one state. This is an intentional part of the design.

Your best bet would likely be to combine both workflows to reflect a more complex state (similar to how the status of Sales invoices combines parallel stock and accoutning workflows to a single state) or to skip the Workflow feature entirely and build what you want with doctype methods and buttons.