Workflow Part 4 – Trigger Methods
Work triggers control how Records and Documents move through the system. There are different work trigger methods to allow us to configure the workflow. That is what we will be discussing here.
Before we move on it is important to note that we have written articles previously talking about the basics of setting up a workflow, Intermediate Configuration, and Action Types. I would encourage you to read those first for background if you have not already done so.
Work Trigger Methods
Since Work Triggers are all independent, you do not just draw a line and items go down that line. You have to think in terms of a process and figure out WHY things go where they do. There are many different ways this can be accomplished and this article outlines some of the common ways.
The simplest way is the Status Method where you use a Status field as the trigger point. A more flexible way is the Flag Method where you set a separate flag field for each trigger. Then there is the more puristic approach called the Data Method where you use only the data available to you through the process and nothing artificial like Status or Flag fields.
Which way is better? As with any good, thoughtful question there is usually more than one answer. If you are looking for the fastest way to get a simple workflow completed then maybe the Status Method would be best. For a more flexible, long term approach then possibly the Flag Method is the way to go. If your application has enough data available then maybe the Data Method is best. It all comes down to what information you have available, how easy you need to make changes and how you feel about managing the workflow in the coming months and years.
This article will give you an overview of each method along with the Pros and Cons of each. Then it will compare and contrast the methods using a simple AP Processing scenario which includes Indexing and Approval triggers. By the end of this article you should have a much better feel of the DocMgt workflow system and how to approach Work Triggers in general.
Status Method
The Status Method is just like it sounds. You would set up a Status field that would have a set of possible values it could be set to. You would key each work trigger on that field but each would look for a different value. For instance, you could have an Indexing trigger that looked at the Status field. If that field had the value “Index” in it then that trigger would be activated. You would then have an Approval trigger that also looked at the Status field and if the value “Approve” was in it then that trigger would be activated. The key here is that in order to make the workflow move along, each trigger needs to change the Status field to the value of the next trigger when it is completed. If the Status field never changes then the workflow does not move along.
Review
- Indexing – Status=Index
- Approval – Status=Approve
Pros
- This method is very simple and easy to follow. Any time the Status value changes you can tell where the workflow will take you.
- Planning out the initial workflow is easy because you would give one status field value for each trigger.
Cons
- Each step needs to knows what the next step is. If the incorrect value is set in the Status then the workflow can miss a step.
- You need to know the entire process to know when to move to and from each step.
- When adding a new step in the middle of a process you will need to change the step before it to point to the new step.
- Exceptions are difficult because you need a separate status for each possible exception.
Flag Method
The Flag Method uses a separate field (flag field) for each trigger. Each trigger will look for its own field’s value to see whether or not to activate. For instance, you could have the Indexing trigger look for a field named “Indexing” with a value of “YES”. Then Approval trigger could look for a field named “Approval” and a value of “YES”. When the workflow is initiated, Indexing will see a field named “Indexing” and a value of “Yes” so it will stop there. Once it is done that step will need to either delete the “Indexing” field or change its value to “DONE” or “NO” or something other than “YES”. Then when the workflow moves along Approval will see that there is a field named “Approval” with a value of “YES” and will be activated. And so on down the chain.
One thing that becomes more important in this scenario is the order of the triggers. All triggers are evaluated in order from top to bottom. If you route a record with fields “Indexing” = “YES” and “Approval” = “YES” and you put Approval above Indexing in the list then Approval will be activated first. That may or may not be desirable so it is something to keep in mind.
Review
- Indexing – Indexing=YES
- Approval – Approval=YES
Pros
- This method is still very simple and easy to follow. Any time you have a flag set then that step will activate although order is more important.
- Planning out the initial workflow is easy because you would give one flag field for each trigger.
- Adding a “Step One and a Half” in the middle is easy because it has its own flag. Just make sure it is in order.
- You only need to know the general order of the process – not the entire process – in order to set up the workflow except for rejections.
Cons
- Each step needs its own flag. That may add a lot of extra data to the Record if there are a lot of steps.
- You need to know what flag field to set to send workflow back for rejection.
- If you get the order of execution wrong then this can cause the workflow to work incorrectly.
Missing Flag Method
The Missing Flag Method is very similar to the Flag Method except instead of a trigger looking to see if a field is set to its value, the trigger sees if its flag is NOT there at all.
For this method, each trigger knows its own flag field and it will set that field only when it is done. That way, no other trigger or process needs to set anything. If the workflow gets to this trigger, and that trigger’s action is not yet completed, it will stop. Then when that trigger is done, it sets its flag field, so it knows it has already finished working this Record.
For instance, you could have the Indexing trigger look for a field named “Indexed”. If the workflow has made it this far and the “Indexed” flag is not there, then the Indexing trigger will stop. When the indexing trigger completes (i.e. a button is pressed) then that button needs to set the “Indexed” flag to something other than blank.
Trigger order is also important in this method.
Review
- Indexing – Indexing = blank
- Approval – Approval = blank
Pros
- This method is still very simple and easy to follow. Any time you have a flag that is not set then that step will activate when it is time.
- Planning out the initial workflow is easy because you would use only one flag field for each trigger.
- Adding a “Step One and a Half” in the middle is easy because it has its own flag. Just make sure it is in order.
- You only need to know the general order of the process – not the entire process – in order to set up the workflow except for rejections.
Cons
- Each step needs its own flag. That may add a lot of extra data to the Record if there are a lot of steps.
- You need to know what flag field to set to send workflow back for rejection.
- If you get the order of execution wrong then this can cause the workflow to work incorrectly.
Data Method
The Data method relies on only the data already associated with the given item. For the indexing trigger you might simply need to evaluate the ‘Total’ field. If the ‘Total’ field is missing or empty then you need to stop at indexing. For the Approval trigger, you might look for an ‘Approved By’ field and if it is missing or empty then stop at Approval. And so on for each step.
With this method, order is still important. You would need to be sure the Indexing trigger is positioned higher than the Approval trigger because you need Indexing done first. However, you can compensate for that by adding in an additional check in the Approval step to also be sure that the Total field is filled in. Therefore, if the Approval step is first in the list then it will only activate if Total is filled in but Approved By is not. That way it skips Approval until Indexing is complete and then is triggered.
One down side to this method is when things need to go back to a previous step. If the Approval user sees an indexing problem then the only way, in this scenario, to get back to the Indexing trigger is to blank out the Amount field. If that field was not in error then you are making users duplicate their efforts just to fit into your workflow model.
Review
- Indexing – Total=(empty)
- Approval – Total=(not empty) AND Approved By=(empty)
Pros
- This method is cleaner than most. You can just focus on the data itself and not worry about artificial flags or status fields.
- Planning out the initial workflow is easy because you simply focus on each trigger’s data.
- Adding a “Step One and a Half” in the middle is also very easy because it just looks at its own data elements.
- You only need to know the general order of the process – not the entire process – in order to set up the workflow.
Cons
- The Records and Documents being routed do not always have enough data elements available to trigger all steps.
- Re-routing back to previous steps becomes tricky and inefficient.
Flag and Data Method Hybrid
Probably the most flexible approach is to leverage both the Data method and one of the Flag methods. This way you can use data whenever possible but have flags for a fall back. Let’s explore this option using the same Invoice Indexing and Approval scenario.
For the Indexing trigger you could have your typical Data-first approach of checking for the Total amount. Then for the Approval trigger you could look for the Approved By field. But to handle the indexing rejection scenarios you could also add in a REINDEX=YES check to the Indexing step. This way if either (A) the Total field is empty or (B) the INDEX field is set to YES then the Indexing trigger will be caught.
Review
- Indexing – Total=(empty) OR REINDEX=YES
- Approval – Total=(not empty) AND Approved By=(empty)
Pros
- This method is still very clean and easy to understand.
- Planning out the initial workflow is easy because you simply focus on each step’s data.
- Adding in “what if” or rejection logic is very simple using a flag field.
- You are relying mostly only data but then putting flag fields in only when needed.
- Adding a “Step One and a Half” in the middle is also very easy because it looks at its own data elements or a flag.
- You only need to know the general order of the process – not the entire process – in order to set up the workflow.
- Re-routing back to previous steps is fairly easy.
Cons
- You need to know what flag field to set to send workflow back for rejection.
Summary
Designing workflow in any system is never truly simple but if you can focus one trigger/step at a time DocMgt can make it more manageable. This article lays out some different options for constructing a workflow. There are pros and cons to all methods but, as we described above, combining methods will sometimes yield the most efficient and manageable workflows. I personally like the Flag and Data Hybrid Method. It works for me in 95% of all the workflows I do. However, there is no one perfect method for all workflows and certainly no perfect method for all users. In the end – just do whatever you are comfortable with. Who knows, you will probably find a completely different method.
Related Articles
Workflow Part 1 – Introduction to the Basics