How to automatically trigger a workflow with form data

Written by Peter Hilton | 4 min read
Published on: November 25, 2016 - Last modified: November 13th, 2020
How to automatically trigger a workflow- finger gesture on a mobile device

Signavio Process Governance users typically start executing workflows manually, by clicking a Start new case button, and entering initial data on a trigger form. However, sometimes you want another system, such as a company’s public website, to trigger a workflow. This Signavio Process Governance tutorial shows you how to set this up by using email to automatically start cases in a workflow.

Using an email trigger to trigger a workflow

The earlier article about responding to customer email enquiries describes a workflow that helps a customer contact team respond to email from customers. In this scenario, customers send email to info@example.com that, in turn, starts a new case of a Respond to customer enquiry process.

This example assumes that the customer sends their enquiry by email. In practice, however, a customer contact team supports a number of communication channels. A typical alternative to email, is to use a simple web page contact form.

Website platforms can generally also send email, so you should be able to integrate this kind of simple contact form with Signavio Process Governance by processing the contact form and sending its contents to Signavio Process Governance in an email that will trigger a workflow, via an email trigger.

Reading trigger email contents

In the Respond to customer enquiry process, the Write response task can display the email content in the form.

You don’t have to do any extra setup to do this in Signavio Process Governance. In the form builder, you can select Trigger email / Body text and add it to the form as a read-only field, as in this example.

The case in Signavio Process Governance shows the contact form information as the trigger email contents, as well as the tasks for responding to the customer. The contact form works the same way as if the customer sent an email, so the process model in Signavio Process Governance didn’t require any changes. It gets more complex when the contact form has multiple fields.

Using JSON for structured form data

Customer contact forms sometimes include additional fields, such as an option to select a specific product.

When the customer specifies a product, the Respond to customer enquiry process can route the enquiry to product-specific tasks, assigned to different people.

This requires a script task that sets a process variable to the value of the Product pick list on the contact form. To make this work, the website that sends the email should encode the form using JSON:

{
  "product" : "Signavio Process Governance ",
  "enquiry" : "Is it available in French?"
}

This separates the values of the two enquiry form fields so that the script task can extract the product value.

This script introduces a new Product variable, and sets its value to the product field from the enquiry form. The script obtains the enquiry form by parsing its JSON representation from the trigger email body text.

Note that the lack of error handling code means that invalid JSON will cause the script task to fail when executing the case, which will halt the workflow. To continue without setting the product value, wrap the code in try-catch statements.

The exclusive gateway can now use the value of the Product variable to route the case to the product-specific task.

The result is a process that you can trigger asynchronously from an external system, via email, including structured data in JSON format.

Published on: November 25, 2016 - Last modified: November 13th, 2020