How to automatically trigger a workflow with form data

Written by Peter Hilton |4 min read
How to automatically trigger a workflow- finger gesture on a mobile device

Signavio Process Governance users typically start executing workflows manually, by clicking aStart new casebutton, and entering initial data on atrigger 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 aboutresponding to customer email enquiriesdescribes a workflow that helps a customer contact team respond to email from customers. In this scenario, customers send email toinfo@example.comthat, in turn, starts a new case of aRespond to customer enquiryprocess.

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 anemail trigger.

阅读触发邮件内容

In theRespond to customer enquiryprocess, theWrite responsetask 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 theform builder, you can selectTrigger email / Body textand 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 aprocess variableto 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 usingJSON:

{ "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 theproductvalue.

This script introduces a newProductvariable, and sets its value to theproductfield 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 theproductvalue, wrap the code in try-catch statements.

The exclusive gateway can now use the value of theProductvariable 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 25th 2016 - Last modified: November 13th, 2020