Business process flows can definitely help guide our application users – they always look nice in the demos, and they easily draw positive feedback. But, it seems, when the BPF is designed to cover multiple entities, there are some quirks there.
Here is the BPF I wanted to create:
There are two entities involved:
- Main Entity
- Stage 1 Entity
Once that simple BPF above is created, here is how it looks like in the user interface while I’m still looking at the Main Entity record::
In order to move that BPF to the next stage, I can create a Stage 1 Entity record, save it, and it’ll be fine.
But what if I made “Start” stage active again?
My BPF would lose that link to the Stage 1 Entity record – I could try moving that process to the next stage at this point, but I would have to create another record:
In order to fix this, I need a lookup from Stage 1 Entity back to the Main entity:
With that new relationship in place, it will also show up in the BPF designer:
That relationship will now be used as a filter for the BPF.
For example, once the lookup is set on the Stage 1 Record:
I will see that Stage 1 Record in the dropdown when trying to navigate to the next stage in the BPF:
Well, let’s say it’s all been set up as per the above, so the BPF is, currently, in the second (“Details”) stage:
What happens if I choose to move that BPF back to the “Start” stage again? It will go back to the previous state – Stage 1 Entity records won’t be in the “process path” anymore:
Looking at the Advanced Find for the “BPF Automation” entity at this point, and it’s obvious that link to the “Stage 1…” record has been removed:
Would not it be great if the BPF kept that relationship somehow instead?
Well, since it does not, it seems this is where we may end up getting more than one “Stage 1 Entity” record for the same BPF if the user decided to create another one. Which is not, necessarily, what we wanted to.
One workaround would be to raise an error when an attempt is made to create another “Stage 1 Entity” record for the same BPF, but how do we do it?
For example, here is how it might work:
- We could create a lookup from the Main Entity to the Stage 1 Entity
- Then, we could use a real-time workflow on create of the Stage 1 Entity record to check if that lookup on the Main Entity had already been populated. In which case we could terminate the workflow and raise an error. If it had not been populated yet, then the workflow could put a value in that lookup and allow the BPF to proceed
- Here is what that lookup would look like in my example:
And the workflow follows below.
Checking the condition (if that new lookup from the Main entity to the Stage 1 Entity has been set):
Terminating the workflow if the condition is met:
Setting the lookup otherwise:
Now if I used the same BPF again, went to the “Details” stage, got “Entity 1 Stage” record created, and went back to the “Start” stage, here is what it would look like:
And, if I tried creating another Stage 1 Record, I’d get an error:
Actually, since Quick Create forms are supported in business process flows, we can make this experience a little better by adding a quick create form for Stage 1 Entity:
- In the example above, our users would get an error message without really leaving “Main Entity” screen.
Is there a better option to handle this scenario? Let me know if you have other suggestions!