Calling all Racers for the Alteryx Grand Prix! It's time to rev your engines and race to the stage at Inspire! Sign up here.

Alteryx Designer Discussions

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

Send email even if attachment doesnt exist

6 - Meteoroid



I want to send an email using Alteryx that has 5 attachments, and if some of the attachments do not have valid filepaths (the file does not exist), exclude those attachments from the email. Is this possible?




17 - Castor
17 - Castor



I would go about this in the following way:

1. Use the "FileExists(" function in the Formula tool(s) to determine which files exist from within the workflow. 

2. Build a macro around the Email tool that uses the list of files that do exist to update the attachments part of the Email tool.


Let me know if you have any questions.

6 - Meteoroid

I do not have experience with macros, so I am not sure where to start with this. Would you be able to show the general setup of the macro?


Thank you.

17 - Castor
17 - Castor

Sure thing. The attached solution will get you started and shows how to use a macro to perform an Inner XML update. 


In the attached solution, the "Build XML" workflow figures out what files exist (and are within the email attachment file size) that should be attached and then builds the XML code necessary for the email macro to use. The Email macro just takes the (inner) XML code and updates the attachments section of the email tool before sending the email. 

6 - Meteoroid

Thank you! This worked flawlessly.

7 - Meteor

Hi Charlie @CharlieS 


I'm attempting to do a similar task as in this thread and have tried out your macro but receive the following error: Error: Email Macro (80): The Action "Tool #5" has an error: ParseError: Expected entity name for reference at line 1 and column 130
while processing "Action_UpdateRawXml".

I wonder if you could assist with this?


My actual goal is not quite the same as mentioned in this thread. I have a workflow which creates files from un-joined data. I would like to attach these files to an email at the end of the workflow. However, some files may not get created, depending on the success of the join. I will create an obviscated workflow if you require it. Thank you very much for the assistance.

5 - Atom

this old post helped me today, thanks CharlieS 😊