We have a process that we are building that will have a variable number of attachments in an email tool. There will be some emails going out with 5 attachments, some with none. What I'm trying to do is create a batch macro that takes the full input, as well as a control input with Invoice # and # of attachments, and using the # of attachments as the control parameter. I believe this is working properly.
The issue I'm having is when I get to the actions on the email tool. For my test, I've added 3 attachments to the Tool in the macro and am trying to say if the Control Parameter only = 2, then Make Attachment 1 and 2 = True and Attachment 3 = False, which I assumed would stop the tool from trying to send Attachment 3. I have 3 separate actions, each one referring to the Attachments>Attachment([name])>ValueIsField and highlighted the @value - value="True" line within the action tool. I then used the Formula ToNumber([#1])>=1, >=2. >=3 for the 3 attachments respectively.
I've tried a few different formulas as well, but every time I get 'Invalid Path: "3" in MakeCleanPath()' for my first record because there is only 2 attachments and it still appears to be trying to find the 3rd attachment. Has anyone had any success at dynamically adding, removing, or changing the number of attachments based on an action? I would like to make the default have 10 attachments and then set them to false using action tools if there is no data in the corresponding fields.
EDIT: After converting to a standard macro for testing, it appears the value I'm changing to false does not delete the attachment, but rather changes the checkbox that states whether you are using a field vs. browsing to a file in the setup. So, it is looking for a file path of '3' when it is successful at changing the value listed above. I don't believe it is possible to change whether or not there actually is an attachment using the Action tool at this time. Someone please tell me if I'm wrong.
Solved! Go to Solution.
Hi,
Without knowing exactly what your code is doing/having an example, I can't say that I have a surefire design that will do this with one Email tool.
However, you could use a series of Detour Tools and 5 different email tools for each set of attachments.
Below is a quick dummy screenshot - There is nothing in the email tools currently. If you need a completely dynamic email option for a totally variable number of attachments, let me know and I'll see if I can come up with something more robust.
@Claje, this is pretty close to what I'm looking for. I was just obsessed with trying to jam it all into the one email tool. It would be a lot easier if there was a true/false option in the action tool for if there should be an attachment at all, but I'm not sure how hard that would be for them.
Anyways, the only thing left would be that I would want to specify the number of attachments from the number on each row of data. If instead of the user input, I keep it as a batch macro and use the Control parameter as the input there, I think I can get it to work. Will report back. Thanks for the input!
Happy to help!
I think I did figure out a "One Tool" solution to the problem - although my one tool is a batch macro.
I've attached an example to this post - I was getting an error uploading the .yxzp file, but was able to save it as a .7z. You'd likely want to modify the input and the email macro to handle your use case (eg dynamic to/from/subject/body are not built in right now), but I hope the batch macro inside this workflow gives you what you need.
Please let me know if you have any questions about this workflow!
Brilliant! Going to mark this as the solution as I was able to get it to work pretty quickly. I will need to dig further to figure out how exactly it works and may still come back with specific questions, but this looks like the path I was trying to go down. I, as a rule, have steered clear of the Update Raw XML with Formula option, as I don't always understand it.
Thanks again! This is awesome!
this macro does not run for me. Can you please help
Hi @JaskiratChohan,
Would you be able to tell me what issue you encountered with this macro? I'm certainly willing to give it a shot if you can provide me with some details on what issues you are running into.
Hi Claje,
I was wondering if you could go further into detail how you set up the Batch Macro. I can see that the macro allows for varied routing based on the number of attachments, but I'm definitely not implementing it correctly - apologies if this is basic, as I'm new to macros in Alteryx! I've attached a sample. Aside from being unsure if I set up the properties in the action tool properly, there are a couple of obvious areas where I know I haven't set it up correctly:
- I don't see where the variable being counted is indicated?
- I don't see where in the workflow the actual attachments are being added to the email tool if there are multiple attachments?
Thank you for any help or insight!
Claje, thanks for posting this - extremely helpful! Would you possibly be able to offer guidance on how to incorporate dynamic to/subject/body in conjunction with the dynamic number of attachments? I'm currently using your batch macro to create emails with a dynamic number of attachments. In the past, I've utilized the "Use Field" option to create emails with dynamic to/subject/body (e.g., based on a list of email requirements stored in a spreadsheet). However, I'm having trouble combining these two concepts into one macro/workflow. Any advice would be very much appreciated - thank you!
Hi,
I just created a tweaked version of the example I originally posted with a revised one-tool macro that adds functionality for all of the email tool configuration.
I've only done limited testing of this, so you should definitely test it yourself.
The changes in the main workflow from my original example are just to give an idea of how you might accomplish this - basically by creating a batch for each email using some kind of identifier, and grouping the file listing with that.
User | Count |
---|---|
19 | |
15 | |
15 | |
9 | |
8 |