/ Development  

Build template BPMs to copy from

Hi there AppWorks fans,

Welcome to a new installment of AppWorks tips.

I see it in every project, I see it at every developer…The creation of a BPM from scratch; time after time with all the basic settings over and over again…STOP! We live in an automagically world, so why not use a template BPM to copy from. The only question left to answer: What should be in it!? Well, let’s find out how our wet-dream-template-BPMs should look like…


Let get right into it…

Pump up your VM with your favorite organization, with your favorite developer account, your favorite workspace, and favorite project…Mine is always the same (because of the VM snapshot I use), so I start in the bpms folder of the project. In this folder, I create a templates folder which is my start location to create our first template BPM.

Don’t wait for me…Just create a new ‘Business Process Model’ type of document where you end up with a clean one-activity BPM. Save it with name bpm_tmp_long_lived. Now what? What should our template have as minimal BPM to copy from? Well, let’s slice it up in pieces…This is my start-point:

tmp_bpm_001


Runtime security

With our first saved BPM, we jump back into the project overview. Have yourself a right-click on the BPM and hit the ‘Define Runtime Security’ action. What are we doing in this screen? Well, you all know about the ‘Security’ BB on an entity. After publication of the entity we expose the ‘Security’ into runtime. For a BPM, we use the ‘Define Runtime Security’ as we don’t have a ‘Security’ BB to use!? Why not? That’s because BPM modelling is an ‘old’ habit of the platform, but still a valid practice to implement advanced business rules. Is it required to add this runtime security? Nope, but is a best practice?…Hell Yeah!

So, ‘Define Runtime Security’!

In the new screen, we can add new roles. You can make a choice here yourself. Create a new ‘Internal’ type of role with a name like int_resource or just use the ‘Identity User’ which is applied (by default) to each user. I add both options…Just because we can! Before I forget…Save that new role nicely in the roles folder of the project! Don’t get messy on me! 😜

Role types in a quick overview:

  1. ‘Functional’ are organization wide roles; examples: ‘Managers’, ‘Reviewers’, ‘Testers’, ‘Developers’, ‘Department X’
  2. ‘Application’ are package specific roles (only within your own solution); examples: ‘Administration’, ‘Employees’
  3. ‘Internal’ give specific access to a required activity; examples: ‘Resource’, ‘Webservice’, ‘BPM’

From the permissions’ matrix we mark the ‘Initiate’ action for both applicable roles:

tmp_bpm_002

Save it all…Close the panel…And the publish? Well, right-click the BPM and do the publication from here (and also publish the role!)…Next!

Hmmm…Do we miss something here!? YES my friend! Add your user to the int_resource role from the ‘User Manager’ artifact…


BPM specific messages

When you craft a BPM there will always be a moment in time you require some variable to save data to (temporarily!?). There will also be a moment in time when you require an input/output message on your BPM. To always use the same ‘recognizable’ variables we define these ‘specific messages’ upfront in the ‘Message Map’ tab of the BPM.

tmp_bpm_003

When you create the implementation of the BPM, you are free to extend the messages with your own requirements.


Comment block

As low-code developer you require to communicate on what the intention of your craftsmanship will be. For this we can add an annotation ‘comment’ block on top of our template. Once making a copy, you only require to update the template text:

1
2
3
4
Name: {bpm_document_name}
Description: {description_of_the_bpm_intention}
Creator: {bpm_initial_author}
Date: {date_format_dd/MM/yyyy}

tmp_bpm_004


‘System’ swim lane

Don’t underestimate the power of swim lanes. You can (optionally) attach a role/team to it and when you add an activity in it, the assignee will inherit from the swim lane. For our template, we add one ‘System’ horizontal lane where we place our template BPM. Just like this:

tmp_bpm_005

When we start with a real BPM implementation you can extend it with other lanes and roles. When already implemented in our template, we can never forget it and our BPM will always have a consistent ‘smell’ (which is the low-code “stamp” that distinct you from the others!)

This is the last action for a final template BPM…The “long-lived” version! You can save and do a validation on it (with <F9>). There is no need to publish it as we will only use it to create a copy when creating new BPMs for a solution.


‘Short lived’ template BPM

A simple task to do…Make sure you have the BPM bpm_tmp_long_lived open and choose ‘Save as’ from the quick access menu:

tmp_bpm_006

Name it bpm_tmp_short_lived, update the description, and save it into the bpms/templates folder of the project. The new BPM is directly opened and from the model properties we only update the ‘Execution Mode’ to ‘Short Lived’! Keep in mind that a short-lived BPM disables ‘Crash Recovery’ and will also put the ‘Monitoring’ to a lower output level. Decide for yourself whether you would like the update this information for you short-lived BPM template. When done, save the template and do a validation on it (with <F9>).

When to short-live and when to long-live

  • “Long Lived” (default): When you have manual tasks and user interaction or when you need delays and wait for event messages. Also known as “Stateful” or “A-Synchronized”.
  • “Short Lived”: When you only have service calls (like we have in our BPM example); Also known as “Stateless”, “In memory”, or “Synchronized” because of the direct feedback in runtime

I always use long-lived and will change it to short-lived when required based on 2 choices:

  1. Do we need direct feedback of the result in runtime?
  2. Do we have performance issues in the long-lived choice?

Copy along

Now what? Well, just copy & paste from now on! Not a real copy & paste but open the template you want to use, and make sure to hit the ‘Save as’ action from the quick access menu again (like you did for the short-lived template!). I can’t make it easier… 🤗


That’s all…”DONE” with two ready for usage templates for your own project implementations. This is hopefully the last time I see you create new BPMs from scratch…Just copy it and pick the beneficial fruits. Have a great templating weekend, and I CU in another post on AppWorks Tips.

Don’t forget to subscribe to get updates on the activities happening on this site. Have you noticed the quiz where you find out if you are also “The AppWorks guy”?