Reputation: 11
I'm exploring Elsa V3 for document approval workflows in my application. The process involves various stages like draft approval, customer review, and legal team approval.
In this scenario, the document undergoes various stages before it's either approved or sent to the customer. Initially, it starts in the "draft" state where it requires approval or changes requested by internal stakeholders. If changes are requested, it branches into its own set of states.
Subsequently, the document progresses through stages such as customer approval, document rejection, legal team approval, and so forth.
I'm wondering if Elsa V3 supports implementing state machines for managing these workflows effectively, with transitions between states.
Any insights, examples, or best practices for implementing state machines in Elsa V3 for document approval workflows would be greatly appreciated.
Upvotes: 1
Views: 404
Reputation: 3419
Not yet, but the architecture does allow for implementing that activity and is part of the roadmap and tracked in this issue that I just opened.
Without the State Machine activity, you can still implement the diagram you shared using the Flowchart activity.
The primary difference would be in the way transitions are represented. In a state machine, the events would be part of the transitions between two states.
In a flowchart, an event is explicitly added as an activity. In addition, to model the diagram cleanly, a set of custom activities should be created that represent individual states and their possible outcomes.
For example, you could create a custom activity called SubmittedToClient
with two outcomes:
Accepted
Rejected
.Or, better yet, you could implement a generic activity called State
that allows you to specify the state name + a list of possible outcomes using the designer.
You would also have to implement a programmatic API to easily trigger this activity using the desired outcome as an event. This way, it would be relatively straightforward to model the diagram you referenced.
This custom state activity could even have two properties of type IActivity
that represent the Enter
and Exit
action.
The State
activity could bring you a long way without the StateMachine
activity. But, a proper State Machine activity should make it easier to do things like query the current state. Additionally, the ability to bind events with transitions should make for a more concise diagram.
Upvotes: 1