Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Automated Email workflow that picks up PDF files in a specified folder as attachment

jsilavong
8 - Asteroid

Hi, 

 

Looking to create a workflow that points to a single folder and sends out separate emails to a specified contact for every pdf file that's dropped into the folder.

 

Essentially I want to drop pdfs in a shared folder and then run my workflow to send multiple email with each attached pdf. 

6 REPLIES 6
TheOC
15 - Aurora
15 - Aurora

hi @jsilavong 

You can easily do this within Alteryx. I'd suggest starting with a directory tool, to get a list of all the PDF files within your folder.

 

You can send an email for each one, and attach the corresponding pdf, by using the email tool. In here you will see that each field can be manually typed, or dynamic and selected from a field. This includes attachments:

TheOC_0-1645717137219.png



This should get you started, give me a shout if you run into any problems!

Cheers,
TheOC


Bulien
jsilavong
8 - Asteroid

 I want to publish tool to the server for other users to run. Is there a way to point the workflow to a folder and it to run with any files that are dropped into the folder.

 

I think if i follow my normal workflow it makes me edit the email too to select the PDFs in the file. I just want the tool to pick up any PDFs that are sitting in the folder and shoot them off to a specified email as an attachment. 

TheOC
15 - Aurora
15 - Aurora

hi @jsilavong 

yes ofcourse! If you use the directory tool:

TheOC_0-1645718419960.png



You can specify a directory to pick up the PDF file locations from. You can also specify to only pick up PDF files using the file specification. You then have the data (as show in the results window). In my case i have 5 results, 5 pdf files in that location. I can then build logic around these (for example, based on the name of them, who they need sending to), and then plug them into an email tool:
If i take the attachment file name from field value (using fullpath), this will attach that PDF file to my email. 

 

This is dynamic, as the directory tool will pick up any new PDF files in that folder, every time it is run. 

 

On the server, i would recommend a shared drive, and ensuring that the server also has access to that shared drive.

 

Hope this helps,
TheOC


Bulien
TheOC
15 - Aurora
15 - Aurora

TheOC_0-1645719152997.png



Sorry, forgot to show functionality of the email tool. You can take the files from a field, rather than looking for a specific file on the machine.

Hope this helps,
TheOC


Bulien
danilang
19 - Altair
19 - Altair

Hi @jsilavong 

 

Alteryx is designed a data prep and analysis tool.  The functionality of the input and output tools is built around getting data into the workflow and sending out the results.  As such, there's no built in way to set up a listener that will trigger an action when a file is added to a directory.  Indeed, the functionality of the input and output tools is so focused on getting data and sending results, that there isn't even a way to move a file without invoking a DOS command or a python/R script

 

While you can't set a file listener, you can work around this by scheduling the workflow to run every so often.  The run frequency will be determined by the needs of your users.  

  • Start the workflow. 
  • Read the timestamp that the last workflow run finished
  • Get all the pdf's from the folder that have be added or changed since the last time the workflow was finished and email them. 
    • Use a Directory tool to get a list of all the pdfs and their last modified timestamps. 
    • Filter for the ones that have changed 
    • pass those to the email tool to use as attachments 
  • Save the timestamp that this workflow finished

The tricky part here is storing the timestamp in a location that will be accessible to the next run.  Workflows are not stored directly on disk on an Alteryx server.  They're stored in a database, extracted to a staging directory when run and then contents of the staging directory is erased.  So the timestamp needs to be stored somewhere external.  This can be on a shared drive, an external db, etc. 

 

Dan

 

 

 

Mattsantos541
6 - Meteoroid

Is it possible to do this, attaching the pdf from Google Drive?

Labels