The following content is the next part of a series of posts relating to the an ongoing scenario. The previous posts in this series can be viewed using the links below:
- Nintex Workflow Recording Sales: Introduction
- Part 1 – Advantage of setting workflow status
- Part 2 – Calculation based on item values
- Part 3 – Making use of Loop N Times
Although this is part of a larger scenario, each post can be suitably viewed separately for those that would like to view this for the general concept.
Using the “Send an Email” action, Nintex allows you to construct a dynamic email that can be made relevant to any scenario. This is because, as well as static and plain text content, you also have the ability to make use of values from list columns and workflow variables.
For confirmation purposes, we are going to send an email to the user that entered the item with details about the new item.
If you have been following this series of posts, you may have realised that we are storing a “Total” variable with a calculated value, but after running the workflow we are not outputting this result anywhere.
In the previous post, we used a workflow to create a number of list items based on a “Quantity” number entered by the user. The original entry is then removed, making way for the new ones.
This is simply a requirement related to record keepings. But the user would certainly not want to gather all of these separate values in order to review a single sale; they would likely still want to see their single record as first entered with a single Total Price.
As these values are all present at the time of starting the workflow, they can all be saved in variables (which we have done already! If not, check through our previous blogs in this series). This means that they can then be used again before the workflow ends!
Adding and configuring “Send an Email” action
I am going to add the “Send an Email” action to the end of my workflow, before the final “Set Workflow Status” action is reached (added in a previous part).
Now to configure the action!
In the configuration options, you may be familiar with the use of workflow variables and list lookups, but there is also the Workflow Context option that can be used.
Now, there is a way to set the “To” field to always be the person who “initiated” the workflow, i.e. added the list item.
To do this, follow these steps:
- Click on the small address book icon to the right of the “To” field.
- You will now be presented with an “Equals” box. From the first dropdown, select “Workflow Context”. Next, select the “Initiator” option
- Click the small “fx” icon to the right of this box
- You should see the “Select return type” popup box. From the options, select “Email Address” and click OK
- When the box closes, click on the “Insert” button underneath the “Initiator” option that you earlier selected.
Now when the workflow runs, it will send this email to the person who caused it to run, the “Initiator”! You can also use the same approach if your list item has a “Person” column in order to send the email to anyone that has been entered in that column!
You can use a similar approach to above in giving the “Head” and “Body” some content by looking around and selecting options that you would like to send with the email.
With my email, I have used the following values in some way or another to create a basic receipt for the user that entered a sale:
- Initiator (return type of ‘Display Name’)
- The ID of the sale
- The item sold
- The price of the individual item
- Quantity sold
- Total price (price x quantity)
Which looks something like the below:
I hope that gives you a greater understanding of the possibilities of composing an email to send automatically from a workflow using the “Send an Email” action.
In the last post in this series we will be posting an example of our full final workflow created from adding the concept of each post together.