Skip to main content

Hello,

This is a variant on an earlier topic. I have a base where users input lengthy URLs into several fields, and corresponding display text in separate fields. I've been using the workaround where a formula field does this calculation:

 

CONCATENATE("[",{name},"](",{URL},")")
 
and an automation takes that field and copies it into a rich-text-formatted long text field. It's clunky, and even clunkier when you have a bunch of markdown formula fields in your base. I'd like to do this with just an automation, but when I try to do it exactly the same way, I get text output like 
 

[Airtable

](www.airtable.com)

whereas my formula approach gives Airtable 

 

Here's the automation script I'm using. Any advice is greatly appreciated!

 

 

let inputConfig = input.config(); let theURL = inputConfig.theURL; let displayName = inputConfig.website; let recordID = inputConfig.recordID; let thisTable = base.getTable('Table 1'); let blank=""; let markup = blank.concat("[", displayName, "](",theURL, ")"); await thisTable.updateRecordAsync(recordID, { "website" : markup }) output.set(markup, "marked up");

 

 

 

On a side note, this type of URL construction seems like a basic feature that Airtable should support better. I see requests for this going back to 2016. Is there a wishlist this could be bumped up on?


Ok I was able to work it out. I'm not actually sure what the problem was because I changed a couple of things at once. Here's my solution:

1) Set the "Simple name" and "URL" fields to one line text. Website is a long text with rich text formatting. Create a calculation that's the time difference between modifications

 

DATETIME_DIFF(LAST_MODIFIED_TIME(URL, {Simple name}), LAST_MODIFIED_TIME(website))

 

2) Create an automation triggered by the calculated time exceeding some number. I set it to 0:00.1. That might need to be tweaked later depending on how Airtable backend does things, so I'll monitor that

 

3) Create a script as such:

 

 

let inputConfig = input.config(); let theURL = inputConfig.theURL; let displayName = inputConfig.SimpleName; let recordID = inputConfig.recordID; let thisTable = base.getTable('Table 1'); let blank=""; let markup = blank.concat("[", displayName, "](",theURL, ")"); console.log(markup) await thisTable.updateRecordAsync(recordID, { "website" : markup })