Building a Workflow
Before you begin…
It is important to note that workflows are configured in the instance they run in. If you run release your app to beta and production, the workflows you create will not be transferred along with it. You would need to re-create them on each environment in order to see them.
Create a new workflow
- Navigate to the Workflows manager in the backend of your application.
- Click on the ‘New Workflow’ button.
- This will take you to the details page for the workflow you just created. Here you can fill out details about your new workflow.
- Make sure you select the entity(s) which you want to associate with this workflow.
- Hit the ‘Publish’ button in the bottom right corner.
- Your new workflow will now appear in the management page.
Add a state
The states are the different steps or statuses of the workflow which the entity moves through. It is very important that you have at least two states, otherwise the workflow is unable to function correctly.
- Open your workflow for editing, and move to the ‘States’ tab in the top-right corner.
- Click on the ‘Add a new state’ button to create a new state.
- Give it a meaningful name.
- Repeat until you have made all the states which you need.
Choose the starting state
Generally, the first state you enter will the one which you want the entities to start with, but if it isn’t, you do have the option of choosing which state should be first. To choose the start state, you need only toggle the large ‘Start’ button (with the flag icon) against the state which should be first.
Add a transition
Once you have two or more states, you can add in transitions between them. The workflow does not assume that the states are sequential, meaning you must add in every transition yourself. Just because they are in a certain order in the list does not mean that is the order the entity will move through.
- Choose the state which is the start of the transition (i.e. if you are moving from state A to state B, select A).
- Under the ‘Outgoing Transitions’ column, click on the ‘Edit’ button to open the transitions panel.
- Switch your focus to the left-hand slideout which should have just appeared.
- Click the ‘Add transition’ button to start the creation of a new transition.
- In the ‘Transition name’ field, give your transition a name.
- Choose the destination state (state B in our sceanrio) from the dropdown of states.
- Click the save button at the bottom of the slideout, or click the add button to create a second transition.
Make sure you publish when you have finished editing!
Reviewing the transitions
If you want to check that you have all the correct transitions in place, the outgoing transitions are listed against each state in the list for your perusal. The number of incoming transitions have also been listed, though you cannot see each individual one (this was done to prevent the confusion of having both directions on one page).
Transitioning an entity
If you have enabled a workflow against an entity, it will now appear as a dropdown attribute when you are editing it’s details. To transition it, you need only choose the state from the dropdown provided.
If an entity has multiple workflows associated with it, it will have multiple dropdowns against it.