Alteryx Server Knowledge Base

Definitive answers from Server experts.

How To Send Dynamic E-mail Attachments Created in a Gallery Workflow

EricWe
Alteryx
Alteryx
Created

How To Send Dynamic E-mail Attachments Created in a Gallery Workflow


This article will help you configure dynamic e-mail attachments with output from a Gallery workflow that can change with each workflow run, such as when the output includes a timestamp. 
 

Prerequisites

 
  • Alteryx Designer, Server
    • Versions: All 
 

Procedure

This article shows how to configure a workflow so that the content of an email attachment is written (or modified) by the workflow at runtime.
  1. Initially, use the Output Data tool to create the attachment. 
    1. If this file is to be accessed by others, you can configure the file name as a UNC path. 
    2. If the file is only used by this workflow, then create the output file in the same folder directory as the workflow.  This can be achieved either of two ways:  Either
      1. Create the output file by giving it a name prefixed by the characters ".\"  OR
      2. Making sure that the file is in the same directory as the workflow, choose the output file by browsing to its location on disk. Next, go to Options, Advanced Options, and Workflow Dependencies.  Change the data source path of the output file to a relative path. Go to the Options, Advanced Options, Workflow Dependencies menu. Select the option to Show Individual Tools, and then choose the Edit button next to the output file. 
        image.png

        Click on the Relative button, and this will change the path of the file selected to be relative to the workflow. The path will appear like this: .\Output.yxdb.  
        image.png
  2. Once the workflow is ready to publish to the Gallery, select File, Save As, and then the Gallery. The Save Workflow window appears; choose Workflow Options and Manage Workflow Assets. image.png
     
    1. In the Save Workflow window, be sure the output file is unchecked as a workflow dependency. When the output file is unchecked, a new file writes to a staging directory each time the workflow runs on the Gallery. The staging directory used for the dynamic output gets removed automatically on a space-needed basis.

      image.png
      If the output file gets checked in the Save Workflow window, the current file saves to the database with the workflow, and it will not change afterward.  
       
    2. If you need to send the output file to recipients using the E-Mail Tool, the attachment field should specify the relative path to the file. Also, using a Block Until Done tool will help make sure that the output file writes entirely before sending the e-mail. 

      image.png

      Similarly, when using an E-Mail Event, be sure the attachment file is configured with a relative path. 

      image.png


Friendly reminder:  The Email tool will send one email for every record that goes into it, so make sure you only have one record at that point if you only want one email sent.

Additional Resources

No ratings