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
Best answer by Lom_Labs
Okay, in principle the script does what it should do: it creates the unique attachment(s) in a separate attachment field. So far so good. Opening up the field and view the unique attachments online with the Airtable viewer is okay, BUT the created files come without file extension, eg. ".pdf", and that's causing inconvenience when attaching to an email by automation. I guess you see what I mean. May you amend the script to keep the initial file extensions?
Thanks a million!
K
Hello @Kai_Muscher! Thank you for your purchase and your invaluable feedback!!
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.
@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.
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
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."
By the way, those links are not matching with the links connected to the docs in the lookup field.
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.
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.
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.
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:
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.
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!
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 😞
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!
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 😞
Dera Lom,
at a first glance this is exactly what we I need. If that works as described then we are golden!!! Let me have a closer look ... :excited: ...
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!
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 😞
Okay, in principle the script does what it should do: it creates the unique attachment(s) in a separate attachment field. So far so good. Opening up the field and view the unique attachments online with the Airtable viewer is okay, BUT the created files come without file extension, eg. ".pdf", and that's causing inconvenience when attaching to an email by automation. I guess you see what I mean. May you amend the script to keep the initial file extensions?
Okay, in principle the script does what it should do: it creates the unique attachment(s) in a separate attachment field. So far so good. Opening up the field and view the unique attachments online with the Airtable viewer is okay, BUT the created files come without file extension, eg. ".pdf", and that's causing inconvenience when attaching to an email by automation. I guess you see what I mean. May you amend the script to keep the initial file extensions?
Thanks a million!
K
Hello @Kai_Muscher! Thank you for your purchase and your invaluable feedback!!
Thank you for your support and let me know there is anything else I can help you with 🙂
Hi! That's it. Thank you so much!
Just one little thing: is it possible that I cannot run the script and send out the email with attachments within the same automation? It indeed creates the uniqueAttachements but somehow same are not attached to the email which is being generated by 2nd action, right after the script being executed. If I run a separate automation to generate the email with attachments then everything is fine as it looks like.
Automation looks like this:
TRIGGER: When a button is clicked
Action#1: Run a script
Action#2: Outlook - send an email with attachment(s)
Just one little thing: is it possible that I cannot run the script and send out the email with attachments within the same automation? It indeed creates the uniqueAttachements but somehow same are not attached to the email which is being generated by 2nd action, right after the script being executed. If I run a separate automation to generate the email with attachments then everything is fine as it looks like.
Automation looks like this:
TRIGGER: When a button is clicked
Action#1: Run a script
Action#2: Outlook - send an email with attachment(s)
Action#3: Update record
Best regards,
K
Hello @Kai_Muscher ! Please add a Find record action that looks for your original record below the Run a script action and then utilise the record data from that Find record action in your Outlook - send an email with attachment(s) action!
New automation:
TRIGGER: When a button is clicked
Action#1: Run a script
Action#2: Find record
Action#3: Outlook - send an email with attachment(s) utilising the record data from the Find record action