Hi there AppWorks fans,
Welcome to a new installment of AppWorks tips.
Again a BPM post!…Why? Well, because last week we played with sub processes and passing messages with data. During that journey a saw (again) the ‘Delay’ construct passing by and as my current project also uses it, I thought it was time to gain more knowledge on this nice feature. So, no time to wait…Let’s go with the flow and…
Let get right into it…
Make sure the environment is up and running, and you have a project to play along with. The BPMs we create are always saved in a subfolder called ‘bpms’, so our project keeps structured.
Let’s start with a simple BPM and directly add that ‘Delay’ construct and check its properties:
Let’s set a delay for 30 sec., save the BPM with a nice name like ‘bpm_delay’ and publish it. For a first run, you can hit
<F12>. Now quick jump to the PIM artifact and check the result!!…Go-Go-Gadget…
As expected…A refresh after 30 sec.? Well…What do you think? CORRECT! ✅
Ok ‘DONE’!?…That was easy…What else?
What about this one?
I learned this trick from the BPM godfather of the platform!…You know who you are! 😎
Hmmm…interesting!? What does it do?
Well, like the activity tells you…When the ‘bpm_child’ subprocess isn’t finished within the delayed time it will be ‘Terminated’, and the parent BPM will be ‘Completed’. You can try it out yourself with these steps:
- Create a subprocess ‘bpm_child’ with just one ‘manual’ activity (so you are able to ‘wait’ is long as you want)
- On that parent process, first create all the constructs, select them all, and do a ‘Group as…Until’. The group will have a static condition with a simple value
true(). This makes sure the ‘group’ is only triggered once, it will wait for the “delay” or the finished subprocess.
- You also see 2 extra ‘end’ constructs. This makes sure the until-loop ‘Breaks’ when any of both parallel activities are finished.
Play around with it and keep the PIM in place for the monitoring…It will give interesting insights with BPM states I wasn’t aware of…Don’t forget to save your changes and do a publication before you start testing.
BPM states list from the documentation:
What else can we do with a BPM delay construct?
Let’s have a closer look at all the available constructs when you hoover of a construct (like for example an activity!)
Do you see what I see?…There are 2 ‘delay’ icons!
- The one on the bottom is the ‘delay’ construct we used in the above examples.
- The one on the left side is a ‘timeout’ construct, or a ‘delayed’ construct…Depends on how you look at things!?
Have a click on that left ‘delay’, and you will see it’s ‘attached’ to the current construct. Is it a pre-timer or a post-timer on the activity? Only one way to find out…Start it and check the PIM!
Hmmm…I get an error, because that ‘timeout’ has no destination activity!?…Ok, sound like a post-timer! Let’s update it like this:
Save, publish, and run…check the PIM…
Hmmm…it’s just ‘Completes’ the flow through the ‘Activity1’….Logical? Off-course! It’s a “timeout”, so we just need to make ‘Activity1’ to ‘wait’ till the timeout expires. I update the ‘Activity1’ to a manual task and do a rerun!
There you go:
I just started the flow, so I get an inbox task. Leave the inbox task alone and wait for 30 sec.
We’re learning stuff here…Do you feel it too? 🤓
What else? Well, looks like that it!? Simple, easy, and efficient…Maybe you can come up with other use-cases where a ‘delay’ constructs will be useful too? Let me know in the comments, and I will try it out as an extra sample to share.
That’s it…Again a BPM “DONE” removed from my backlog with again a great BPM feature, so we are able to ‘delay’ our BPM. You also see I just play along with these kinds of constructs, so I gain better knowledge on what they do and how they can help me in building my own BPMs. I also never used this construct myself but saw it passing by in any of the BPMs in my own project and was just curious. Be curious and always ask yourself the question: How to use such a feature and play along with it? It helps me to gain better knowledge of it. Hopefully this post will also bring you one step further into AppWorks greatness…I CU in the next one! Cheers.