Extract the link for last attachment added

Topic Labels: Formulas
1473 6
Showing results for 
Search instead for 
Did you mean: 
6 - Interface Innovator
6 - Interface Innovator


I can’t seem to figure out what I’m doing wrong. I’m trying to pull the link for the last attachment added and the only way I thought to try was using Regex. I tested in regex101 here: regex101: build, test, and debug regex

I’m using this in a formula field: REGEX_REPLACE({Image URLs},'.*\\((?=[^(]*$)','') and just get an error.

I’m trying to extract from an attachment field:

190423-LMOps005Pool-Fitness0130_blue.jpg (, 190423 LMOps005Pool Fitness0130.jpg (
6 Replies 6

Hi @Brent_del_Rosario
I am sorry I am not up to speed on REGEX maybe that formula is only good if there is only a single attachment. But if you just want to see the URL, this script will output all of the attachment details for a record.

let table = base.getTable("Table 1");
let record = await input.recordAsync('Select a record to use', table);
let attachments = record.getCellValue('Attachments')

It should not be too hard to expand on and just get the last URL if that is what you want and you could go further to have it update a text field.

You should be aware that even if you get the formula to work, it will not work come November.

I’ll see if I can pull from that and use it in an automation.

Thanks for the heads up! I’m using this for approving edits and suggested images to move from a Preview field to an Image field. We then use a tool to do a datamerge in Indesign. Expiring links won’t really apply to us as we’ll only need to download once.

The issue isn’t just expiring links. The links extracted using formula fields will be invalid. In order to get the expiring link, you will need to use a different method, such as scripting or a 3rd party tool.

Yikes. I guess we’ll just revert to adding attachments via links in our DAM. I’ve been meaning to build some workflows around that anyway. Thanks!!