Skip to main content Skip to complementary content

Implement BPM-like long running processes with human interaction

Qlik Application Automation for OEM is an iPaaS platform, focussed on building API integrations between cloud applications. In Qlik Application Automation for OEM you build automations (workflows) to implement data flows. These automations typically run based on a trigger or a schedule and they run in the background until completed. This means that by default, automations cannot ask for human input while they are running.

Note: automations can, however, accept human input at the start of the execution. See the Input block for more information.

This article describes how you can implement an automation that requests human input at any point in a flow, waits for that human input and proceeds with the flow after the human input was received. In other words, we show how BPM-like processes (Business Process Management workflows) can be implemented in Qlik Application Automation for OEM that are potentially long-running and where human input is needed at certain points during the execution of the flow. We also refer to this as the man in the loop pattern.

We use the Qlik Application Automation for OEM Data Store to create transactions (flows). We use the Data Store to persist these transactions until they are completed.

We create a scheduled automation that runs e.g. every 5 minutes. The automation consists of four parts that are executed on each run:

  • Create new transactions if needed, based on a certain connector.
  • Request human input.
  • Wait for human input and process the human input.
  • Expire old transactions.

Note that this logic can also be implemented in multiple separate automations that all read from/write to the same Data Store (the Data Store is used as a simple Message Bus).

In the following paragraph, we will cover the different components of the flow.

Create new transactions and request human input

Our example automation will check for new companies created in a CRM on each run. If no new companies are found, nothing happens. If a new company is found, a transaction is created in the Data Store.

Creating a transaction.

an automation consisting of a Start block and a List Updated Companies Incrementally Only block containing a Get Item block and a Condition block, which accesses an Add Item block and a Send Mail block if no transaction is found.

We use the company id as the unique transaction id:

Creating a transaction id.

The Inputs tab of the Add Item block. The Uniquekey field is set to List Updated Companies Incrementally Only > Item > Id.

In order to request human input, we created a form using a Form Builder tool. In this example we used Wufoo.

In the Blend, we send out an email to a user to ask for human input. We add a link to the form in the email. We pre-populate the form by adding parameters in the query string. We make sure to also add the transaction id in the form:

Populating an email for human input.

The Inputs tab of the Send Mail block. The body contains a link that is altered by the List Updated Companies Incrementally Only block's Id.

This is the full URL to the form, used in the above example:

https:// blendrio.wufoo.com /forms/m1qe8v0m160x8ua/def/
      field1={$.listUpdatedCompaniesIncrementallyOnlyOnce.item.id}
   &field2={ $.listUpdatedCompaniesIncrementallyOnlyOnce.item.name }

The user will receive the email, click the link and the form will be opened, with certain fields pre-filled:

A form in Wufoo.

The linked form, with the Transaction id and Company name fields filled in.

When the user submits the form, a new form of entry is created in Wufoo. The next part of the automation will process new form entries (form submissions).

Process human input

In the next part of the automation (or in a separate Blend), we check for new form entries. When a new form entry is available, we check if we can find a matching transaction in the Data Store. If found, we will process the human input and set the transaction to processed.

Note that this means we wait for human input because the automation will run e.g. every 5 minutes and as long as no new form entries are available, nothing will happen.

Processing human input.

an automation consisting of a Start block and a List New Entries Of Form Incrementally block containing a Get Item block and a Condition block, which accesses an Add Item block, an Update Company block, an Update Item Status block, and a Send Mail block when a transaction is found.

For each new form entry, we get the transaction id from the form submission to find an existing item in the Data Store:

Finding an item based on id.

The Inputs tab of the Get Item block. The Uniquekey field is set to List New Entries of Form Incrementally > Item > Field 1.

In the current example, we use human input to update the name of the company in the CRM:

Updating a company name.

The Inputs tab of the Update Company block. The Id field is set to List New Entries Of Form Incrementally > Item > Field 1, and the Name field is set to List New Entries Of Form Incrementally > Item > Field 2.

Remember that the transaction id from the form (Field1) is also the company id in the CRM. Field2 in the form is the company name field.

Finally, we set the transaction to processed in the Data Store:

Setting a transaction to processed.

The Inputs tab of the Update Item Status block. Status is set to processed, and Uniquekey is set to List New Entries Of Form Incrementally > Item > Field 1.

This is only needed to exclude them from the next part of the automation (setting old transactions to expired).

Expire old transactions

In the last part of the automation (or in a separate Blend), we set old transactions to expired and we send out an alert by email:

Sending email alerts.

an automation consisting of a Start block and a List Items To Process block containing a Condition block, which accesses an Update Item Status block and a Send Mail block when a transaction's last update was over one day ago.

Note that the block List items to process will not return items that have the status Processed.

For transactions that are not yet processed, we check their timestamp last update. If that is more than 24 hours ago, we set the transaction to processed (or failed) and we send out an alert email:

Setting a one-day timer.

The Inputs tab of the Condition block. It activates if the difference between now and when the item was last updated is greater than one day.

This article provides a very simple example. It is, of course, possible to add more logic, e.g. send out reminders to users if no form submission is received or escalating to other users. This would be accomplished by updating the transaction in the Data Store, and keeping track of emails already sent out, etc. including the timestamps of these events.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!