Intermediate Timer Event with ProcessMaker

We were recently asked to provide a solution for the following process definition:

As you can see, upon completion of First Activity, the Case is expected to pause  for X days. In BPMN terminology, it means a Catching  Intermediate Timer Event takes place between First Activity and Second Activity.

So, how can you solve this process design using ProcessMaker? Well, it’s easy to solve if you feel comfortable with Triggers, and if you understand how to pause a case.

Any ProcessMaker business architect knows from day one that it is possible to pause a case manually, as shown on the following screenshot:

But this feature is intended to be accessed through the user interface, and the end user is expected to pause a running activity manually.  (Note: for those among you already familiar with ProcessMaker, the word Activity in this article points to the term Task inside ProcessMaker.)

The main difference between this standard ProcessMaker feature and the above mentioned process definition, is that ProcessMaker freezes a Case during a running activity for a specified amount of time. Thus, we need to mimic the required process design, which expects an activity to be completed, then a Timer Event is inserted, before the next activity can be started.

In the following section we will explain the detailed procedure to pause a case for 10 days upon completion of First Activity. After 10 days, the Second Activity wakes up.

We will invoke pauseCase() function, which will freeze the case until March 3, 2011 in First Activity. (Remember, ProcessMaker can only pause a Case inside a running Activity.) The following steps cover how to create this sample process.

  1. Create a process named Intermediate Timer Event as follows:
  2. Create a simple dynaform and assign a user to both tasks (First Activity and Second Activity).
  3. Create a trigger, and name it Freeze First Activity.
  4. Insert the following code:
    $ind = @@INDEX;
    // next activity corresponds to @@INDEX + 1
    // we plan to pause the case for 10 days (from the date of this post)
    $date = '2011-03-03';
    // now we need to know who's the next user in charge.
    $sCurrentUser = $resp[1]['USR_UID'];
    // finally we pause the case inside First Activity until 2011-03-03
    $x = pauseCase(@@APPLICATION, $ind, $sCurrentUser, $date);
  5. Place this trigger inside First Activity, and configure it to be executed After Derivation:

Note that the wake-up date is written in hard code in this example. Keep in mind that you can use PHP to define this date with complete freedom, querying databases and setting any level of complexity to decide when this actual date could be.

Have fun!

About This Author

Customer & Partner Support Manager for Colosa Inc. and ProcessMaker.