May 16, 2022 11:54 AM
Hi Airtable community,
Is there any way to:
(Tried using Zapier, but unable to automate deleting the files in Airtable)
Or are there any other ways that this can be achieved other than form attachent, as I know it is not ideal…
Thanks in advance!
Solved! Go to Solution.
May 16, 2022 01:58 PM
With the scripting app you can pass a blank array to the field to clear it out.
Attachments allow you to add images, documents, or other files which can then be viewed or downloaded.
When updating an existing attachment cell value, the specified array will overwrite the current cell value. If you want to add a new attachment without deleting the current attachments, you can spread the current cell value like so:
let newAttachmentUrl = 'example.com/cute-cats.jpeg';
myTable.updateRecordAsync(myRecord, {
'myAttachmentField': [
...myRecord.getCellValue('myAttachmentField'),
{ url: newAttachmentUrl }
]
})
Similarly, you can clear the current cell value by passing an empty array, or remove specific attachments by passing a filtered array of the current cell value.
Note: when you pass an existing attachment, you must pass the full attachment object. New attachments only require the url
property. You can optionally pass the filename
property to give it a readable name.
Airtable generated attachment URLs do not currently expire, but this will change in the future. If you want to persist the attachments, we recommend downloading them instead of saving the URL. Before this change is rolled out, we will post a more detailed deprecation timeline.
May 16, 2022 12:53 PM
May 16, 2022 01:21 PM
I only want to delete the attachment. :frowning: I was using make and did not find a way to do it without deleting the entire record…
May 16, 2022 01:58 PM
With the scripting app you can pass a blank array to the field to clear it out.
Attachments allow you to add images, documents, or other files which can then be viewed or downloaded.
When updating an existing attachment cell value, the specified array will overwrite the current cell value. If you want to add a new attachment without deleting the current attachments, you can spread the current cell value like so:
let newAttachmentUrl = 'example.com/cute-cats.jpeg';
myTable.updateRecordAsync(myRecord, {
'myAttachmentField': [
...myRecord.getCellValue('myAttachmentField'),
{ url: newAttachmentUrl }
]
})
Similarly, you can clear the current cell value by passing an empty array, or remove specific attachments by passing a filtered array of the current cell value.
Note: when you pass an existing attachment, you must pass the full attachment object. New attachments only require the url
property. You can optionally pass the filename
property to give it a readable name.
Airtable generated attachment URLs do not currently expire, but this will change in the future. If you want to persist the attachments, we recommend downloading them instead of saving the URL. Before this change is rolled out, we will post a more detailed deprecation timeline.
May 16, 2022 05:25 PM
To clear out any field in Integromat or Make.com, you simply update the field with the null
function that appears on the general functions tab:
May 18, 2022 09:52 AM
Thanks Scott. Can I ask another question?
Why is box not downloading the files fully from AirTable’s attachment? The files downloaded are less than 100kb…
May 18, 2022 10:06 AM
No idea. Are you sure that Box is looking for a URL? It could be looking for an actual file. If it’s looking for a URL and it’s still not working, then I would reach out to Make tech support to ask them, and report back here with what they say.
May 18, 2022 11:57 AM
Figured it out with Zapier instead. Might have to use both of these automation tools now… haha
Thanks again Scott! Appreciate your help.