In this article, you can learn how to add extra functionality to your Form by attaching workflows.
Workflows are a way of defining actions after your Form is submitted like sending an email or creating a content node.
By default, when a Form is submitted the record data is stored in the database. This can be configured in the Store records of the Forms settings.
The behavior to display a message to the user who submitted the form can be configured by clicking on the built-in first workflow step. This step is labelled Submit message/Go to page, and it can also configure the redirection to another page.
If a value is selected for Go to page, it will be used to redirect to that page once the form has been submitted.
If no value is selected, the message in Message on submit is displayed to the user on the same page, instead of the form fields. This is implemented via a redirect to the current page, ensuring that the form can't be accidentally resubmitted.
By default, the message is created and rendered in plain text. If you need to add formatting to the message, toggle the Format message in rich text button.
At the bottom of your Form, a default workflow is already attached to the Form, as well as an option to configure the workflows.
Clicking Configure workflow will give you the option to configure existing workflows, as well as setup new ones.
A new workflow can be of different types and Umbraco Forms ships with a few default ones. You can find an overview of the types in the Workflow types article.
Once the Workflow Type has been selected, you will need to configure the workflow. There are different settings depending on the type that has been selected.
To use data from the submitted Form in your workflow, head over to the Magic Strings article and learn more about how that's done.
You can apply conditions to a workflow that trigger it only under specific circumstances. After adding the desired workflow type (for example, sending an email), you can add a condition to the workflow.
Select Enable conditions to open the condition editor. In the condition editor, you will see options to create logic that determines when the workflow should run. The condition is generally based on the values of the form fields.
For example: You have a form with a dropdown field labeled Preferred Contact Method with options such as Email and Phone. You can set up a workflow that sends an email notification only when the user selects Email.
Now, this email notification will only be sent when the user selects Email as their preferred contact method.
Fill in the rest of the settings and click Submit. The workflow is added to your Form and displayed at the bottom of the page.
When a form is submitted, any workflows associated with the "submit" stage of the form will run sequentially in the configured order. The record is stored after these workflows are completed, and as such they can make changes to the information recorded.
Similarly, approval of a form entry, whether automatic or manual, will trigger the execution of the workflows associated with the "approve" stage.
Rejection of an entry will trigger the execution of the workflows associated with the "reject" stage.
If a workflow encounters an unexpected error, it will silently fail from the perspective of the user submitting the form. The exception along with the other details of the failed operation is recorded to the log.
From Umbraco Forms versions 8.13.0 and 10.1, an audit trail has been made available. In the list of entries for a form, a summary is presented that shows how many workflows were executed, and how many were successful:
For each entry, in the backoffice a table can be viewed that shows each of the workflows and the success, or otherwise, of the operation.
For any workflows that did not complete successfully, a "Retry" link is available to trigger the workflow again. This is useful for example if there was a temporary infrastructure issue that perhaps prevented an email going out. You would be able to retrigger the workflow once the issue is resolved.
This article will give you an overview of the Workflow Types available in Umbraco Forms.
There are multiple built-in Workflow Types that can be used to extend the functionality of your form. Do you want to post the submitted form as XML, send the data as an email, or send a notification through another messaging system? These are a few of the options you can choose when working with Umbraco Forms.
Used to automatically Approve Record, Reject Record or Delete Record once it is submitted. Configure words that you want to match and select whether these words should trigger an approval or deletion of the record.
Used to post the Form as an XML to a specified URL. The following configuration can be set:
Workflow Name
URL (required)
Method
XsltFile - used to transform the XML
Headers - map the needed files
User
Password
Saves the result of the Form as an XML file by using XSLT. The following configuration can be set:
Workflow Name
Path (required) - where to save the XML file
File extension (required)
XsltFile - used to transform the XML
The path needs to point to a folder, not a file name. The files are then stored locally, and relative paths are resolved to the content root.
When storing the files within the wwwroot
or App_Plugins
folders, the files will be publicly available by default.
Saves a submitted Form as a new content node. You need to choose a Document type and match the fields in the Form with the properties on the selected Document Type.
You can also choose to set a static value to fill in the properties:
In the example above, a Document Type called Blogpost is selected for creating the new Content node.
The value from the Name field will be added as the Node Name property in the new Content node. The value from the Email field will be used as the Content property.
The following configuration can be set:
Workflow Name
Publish - choose whether to publish the node on submission
Where to save - choose a section in the content tree where this new node should be added
Sends the result of the Form to the specified email address. The following configuration can be set:
Workflow Name
Message (required)
Attachment - specify whether file uploads should be attached to the email
Recipient Email (required)
CC Email
BCC Email
SenderEmail
Reply To Email
Subject of the email (required)
For fields that accept multiple email addresses (Recipient Email, CC Email, BCC Email), you can separate addresses using semicolons (';') or commas (','). For example:
If the Sender Email field is not populated, the address used will be read from CMS configuration.
The Content Settings value configured at Umbraco:CMS:Content:Notifications:Email
will be used if provided.
If that is not set, the Global Settings value configured at Umbraco:CMS:Global:Smtp
will be used.
The fallback behavior also applies to the other email workflows.
Uses a template to send the results of the Form to a specified email address.
You can create your own custom Razor templates to be used to send out emails upon Forms submission. Read more about how to create these templates in the Email Templates article.
The following configuration can be set:
Workflow Name
Email Template (required) - specify which template you want to use
Header text - formatted text that will be rendered above the form entry details
Footer text - formatted text that will be rendered below the form entry details
Attachments - specify whether file uploads should be attached to the email
Recipient Email (required)
CC Email
BCC Email
SenderEmail
Reply To Email
Subject of the email (required)
Sends the Form to a URL either as a HTTP POST or GET. The following configuration can be set:
Workflow Name
URL (required)
Method (required) - POST, GET, PUT or DELETE
Standard Fields - optionally include and map standard form information such as name and page URL
Fields - map the needed fields
User
Password
When mapping fields, if any are selected, only those chosen will be sent in the request to the configured URL. If no fields are mapped, all will be sent.
The receiving endpoint extracts form fields and values using GET for querystrings and POST for form collections.
As an illustrative example, the following code can be used to write the posted form information to a text file:
Sends the result of the Form to an email address with full control over the email contents by providing an xslt file. The following configuration can be set:
Workflow Name
XSLT File - specify which file should be used to transform the content
Recipient Email (required)
CC Email
BCC Email
SenderEmail
Reply To Email
Subject of the email (required)
Allows to post the Form data to a specific channel on Slack. The following configuration can be set:
Workflow Name
Webhook URL (required)