Help

Re: How to avoid multiple attachments with same file name

Solved
Jump to Solution
3959 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Kai_Muscher
6 - Interface Innovator
6 - Interface Innovator

Dear Community,

I hope someone can help me with the following issue...

I have an automation sending out an email for a record ("shipment" table) with attachments.

 

The attachment(s) come by lookup from my "inventory" table.

 

Now, as some inventory items may have the same attachment (eg. an invoice covering several inventory items/lines) I consequently get several same attachments pulled to the "shipment".

 

How can I tell airtable or my automation to ignore files with same filename when sending out email for a record ("shipment" table) with attachments.

 

It's hard to explain, but I hope someone will see my issue. 🙂

 

Kai

 

1 Solution

Accepted Solutions

Hello @Kai_Muscher! Thank you for your purchase and your invaluable feedback!!

The script has been amended to keep the initial file extensions as you requested. Please regenerate your script so that you have the new functionality! You can do so here: https://www.lomlabs.io/airtable/scripts/unique-attachments

Thank you for your support and let me know there is anything else I can help you with 🙂

See Solution in Thread

14 Replies 14

Hmm, you could use a script for this.  You'd have an 'Attachments' type field in 'Shipments' and a lookup field to display all the attachments in the linked 'Inventory' records, and your automation would be:

1. Script runs and looks through all the attachments from the linked Inventory records and creating a list of only unique attachments via the file name
2. Uploads this list of unique attachments into the 'Attachments' field in 'Shipments'
3. Send email action uses the files that were just uploaded

@Kai_Muscher Your best bet is to use Make’s Airtable Automations to do that, because it doesn’t require any coding at all! It lets you dynamically name your attachments when attaching them to outgoing email messages. 

HI, Scott!

Thank you so much for your message. Maybe I can show you an example to underline my situation. See attached screenshot showing my list of transports (shipments table) with the items included from my inventory table.

Now, the transport includes 10 pallets covered by the same commercial invoice. Consequently the "CI (lookup inventory)" pulls 10 times the same invoice because every pallet line is having the same CI attached individually.

When I want to send a shipment information by automation there is 10 times the same invoice attached. Somehow I need to tell airtable to ignore duplicate filenames. Maybe I am completely on the wrong path...And I don't see an approach by using Make.

 

Kai

 

ScottWorld
18 - Pluto
18 - Pluto

In Airtable, you could use a rollup field to only show you unique values from a linked record field by using this formula: 

ARRAYUNIQUE(values)

Then, you can use Make to iterate through just the values in that rollup field (which is an array of values).

If you’re new to Make, this might be challenging to setup for the first time. I show how to work with arrays in this Airtable podcast episode: 

https://youtu.be/sKPyG0HZCYY?list=PLqssva4liHRwHhQIpTXekG8WObEoyC2F1

I’m not sure if your company has a budget to hire an expert for your project, but if you’d like to hire me as your expert Airtable consultant to setup all of this for you & train you on it while I’m setting it up, please feel free to reach out to me through my website: Airtable Consulting — ScottWorld

 

Hi, Scott!

Thanks a million again. The idea to go with rollup/ARRAYUNIQUE(values) definitely is the right direction. Indeed, that is extracting only the unique file names and the associated download links. BUT when trying to access the rolled'up docs/links it results in "The link you're trying to visit is not available. Please visit our support center for more information."

Bildschirm­foto 2024-03-01 um 12.08.17.png

By the way, those links are not matching with the links connected to the docs in the lookup field.

Any ideas?

 

K

ScottWorld
18 - Pluto
18 - Pluto

Oh, unfortunately, you can’t use formula fields anymore to get valid URLs from attachment fields.

You can only get valid attachment URLs (your choice of expiring URL or Airtable viewer URL) by using scripting, Airtable’s automations, or an API tool like Make’s automations and integrations for Airtable.

I show how to use Make to work with attachment fields and attachment arrays in this Airtable podcast episode.

Scott, I hammer my head but I don't see a way to get valid attachment URL(s) by using Airtable automations. I could live with having the URL(s) shown in the email instead of having the filed attached.

I am glad that you immediately realized my problem. Let me reach out to you in a separate conversation to talk about potential collaboration/consultation.

 

K

 

ScottWorld
18 - Pluto
18 - Pluto

Hi @Kai_Muscher,

Airtable has hidden it in a secret location in its automations.

After you insert an attachment field into your automation, click on the “Display” option, and choose between “Expiring Download URL” or “Attachment Viewer URL”.

Check out the screenshot below:

IMG_0326.jpeg

If you decide to use an API automation tool like Make, these options won’t be hidden there, because they are just a normal part of Airtable’s API.

p.s. If you have a budget for your project and you’d like to hire an expert Airtable consultant to help you with any of this, please feel free to contact me through my website: Airtable consulting — ScottWorld 

Lom_Labs
7 - App Architect
7 - App Architect

Hello @Kai_Muscher! We have built an automation script for this!: https://lomlabs.gumroad.com/l/kvdyr

With this simple script you only need to key in the names of the table, lookup field and attachments field and it will remove the extra attachments with the same name!

Unique Attachments.gif

Now you can send the email for your Shipment record with only the unique attachments from the linked Inventory records!

You can even try it before you buy it!

It is not recommended to use expiring attachment URLs in your emails because Airtable only ensures they are active for at least 2 hours! Your email recipients might be frustrated once they click on the link and it does not work 😞