In the previous post, we created an App for confirming whether email addresses entered into a web form exist. It was designed so that the URL of the following [Receive Task (Form)] would be sent to the email address that had been submitted and completes if the Task is Operated. Even though this will work fine, let’s refine the settings a little more.
- Set an expiration time for processing the [Receive Task (Form)]
- Set a validation check on the input email address in the [Message Start Event (Form)]
Set an expiration time for processing the [Receive Task (Form)]
Using the current settings, the Process will never finish until the [Receive Task (Form)] is processed. In cases where we want to confirm the presence of an email address, it should not be necessary to wait for too long. In addition, even though the URL of the [Receive Task (Form)] is randomly generated, the risk of the URL becoming known to others increases as time goes by.
You can set an expiration time for handling the Task in the properties of a [Receive Task (Form)]. Let’s configure it to, for example, 7 days after the Process started.
First, create a Data Item for storing the expiry date and time.
|Data Item Name||Data-type||Remark|
|Expiration||(No display)||(No display)||(No display)|
By specifying processInstanceStartDatetime.addDays(7) as the initial value of the Data Item “Expiration”, the value in the Item will be the date and the time of 7 days after the Process started.
Then, by inputting the “Expiration” Data Item to the Deadline field in the General tab, the deadline for inputting to the public web form is set.
Once you set up the deadline in the [Receive Task (Form)] a deadline icon will be displayed on the Service Task icon. Add an End Event and connect to it from the deadline icon so that the Process ends when the expiration time is reached.
In addition, append the following sentence to the body of the email which is sent at the [Throwing Message Intermediate Event (Email)] to notify that the public web form will expire.
Set a validation check on the input email address in the [Message Start Event (Form)]
Since there are some rules on strings in email addresses, it would be better for obviously improper character strings to be removed when an email is entered to the form. By setting up a Regular expression to be satisfied in the Email address Data Item, you can restrict the input to a specific format. The following regular expression is recommended to represent the expected format for email addresses.
This is a regular expression that is actually being used inside Questetra BPM Suite. That means it is the format for email addresses allowed in Questetra BPM Suite. Incidentally, this regular expression represents a format in which the following are excluded from Address Specification in RFC 5322.
- White Space
- Control Characters
- IP Addresses
- Formats that have been made obsolete in RFC 2822
- Format including quote-string
In addition, set up the Placeholder text and the Description to tell the public form users that the input is being validated. Placeholders are for indicating an input example, so set up a suitable email address such as “firstname.lastname@example.org”. Since it will disappear when you start typing, it is appropriate to show merely an example, not to write important details. In the Description, briefly explain the restrictions on inputting character strings, e.g. “Only input alphanumeric and symbols in a single byte.”
This completes the input deadline and email address validation. Please utilize web forms of Questetra BPM Suite in your business!