This is the third article in the Reporting in Alteryx series. The first two articles are:
As much as corporate America likes to complain about email, it’s hard to do business without it. Email can be time-consuming. But what if you could use Alteryx to automate routine emails?
Enter: the Email tool.
Source: GIPHY
There are lots of interesting use cases for the Email tool—you can send an email when a workflow finishes running, you can set up emails for when something goes wrong in your workflow, or you can email out some version of the results of your workflow.
In the example I will walk through in this article, I email a summary data point and then attach an Excel sheet with the full data. Since Small Business Saturday is coming up next month, my use case is a small retail business with daily sales data from its POS system. If the store wants to email weekly reports to its stakeholders, it can use Alteryx to automate this process!
Building the Email
Before you start designing your emails and running your workflow, it’s important to note that there is an option to enable the Email tool in its configuration, which is checked by default. I recommend unchecking this option while developing your workflow so unnecessary emails are not sent. Then, you can check the box when you are ready to start testing.
To set up the Email tool, you need to know the SMTP server name, port, and encryption for your organization's email system. If you get stuck, refer to the SMTP Troubleshooting knowledge base article and the Email tool help doc.
For the email components, you can either pull them from fields in your workflow or type them in the tool's configuration. For this article, I am pulling them from fields to make the example workflow more dynamic.
The Email tool will send an email for each row of data coming in, so make sure your incoming data is structured where each row has a different “To” email address (if there are multiple emails to send).
The from, to, and subject lines are easy enough—they are pulling from rows of data feeding into the tool. I used a Formula tool to create the header field based on the date in the input data. (Note: the data below is dummy data so that the workflow attached doesn’t send out emails to real people.)
I constructed the body field in a Report Text tool. This allows for including data fields in the text and more formatting options than a formula tool. I could get my email to look exactly like I wanted it to within the tool. I can even personalize the emails by including the recipient's name from my dataset—pretty cool!
Now that we have the email components built out, let’s look at how to attach data.
Attaching the Data
I wanted to dynamically attach whatever is in the full input dataset. To do this, I first created the file name with the formula tool using the earliest date in the dataset. Then, I wrote the data using the “Change Entire File Path” option.
With this structure, you can receive new data each week and not have to update the workflow because the attachment data will be saved as a new file with the date in the file name.
Since I wanted to write the attachment data and send the email in the same workflow, I used the Block Until Done tool to ensure the data was written before any downstream process ran.
I used the same file path (minus the sheet name) to attach the data to the email. Inside the email tool, under the attachments section, I clicked the add button. Then I configured the attachment as seen below:
This way, the same data written earlier in the workflow will be attached to the email.
Sending the Email
On to the final piece—testing the email! Time to check the Enable option in the Email tool configuration.
I sent the email to myself for testing, and here is the result:
I kept the email pretty simple, but I hope you can see through this example how powerful this tool is for automating business processes!
You could utilize some other reporting tools, like the Image, Table, or Interactive Chart tool, to include even more in the body of your emails. And if you had a different dataset to send to each recipient, you could put the email tool into a macro.
Hopefully, this short series on Reporting tools has shown you some new ways to streamline and automate your processes with Alteryx!
Is there a topic you would like me to write about next? Leave it in the comments :)
Resources:
Tool Mastery | Email
SMTP Troubleshooting