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.
SOLVED

Send email even if attachment doesnt exist

bmyles
6 - Meteoroid

Hi, 

 

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?

 

Thanks,

Ben

8 REPLIES 8
CharlieS
17 - Castor
17 - Castor

@bmyles

 

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.

bmyles
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.

CharlieS
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. 

bmyles
6 - Meteoroid

Thank you! This worked flawlessly.

Chris_Waspe
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.

PerryT
5 - Atom

this old post helped me today, thanks CharlieS 😊

Ganesh123
7 - Meteor

I am getting error while using the above formula please assist

pfiskrat
7 - Meteor

Thank you! This macro worked for me.

 

I only had to make 1 small change as I was also getting the error as mentioned above: The Action "Tool #9" has an error: ParseError: expected entity name for reference at line 1 and column 92 while processing "Action_UpdateRawXml"

 

I had some special characters in my attachment paths, I added a formula to replace the "&" symbol with a "&" and that solved my problem. 

Labels