Copy and Paste from Date to Link fields UPDATE

Hi! I saw an article that discuss my problem, but didn’t have the solution. I’m trying to create an automatization that runs a script to copy a field (formula that puts year and month together like this 2021-12) to a liked to field whenever a record is created ou updated.

So I found here this solution that requires you to put the field you want to copy as a primary field

let dateT = base.getTable('Dates');
let dateQ = await dateT.selectRecordsAsync();

for (let rec of dateQ.records) {
    let dateFieldID =
    await dateT.updateRecordAsync(rec, {
        'Date Link': [{id: dateFieldID}]

But I can’t make this because I use my primary field to make a resume for my Calendar view title record. Here is a simple example how my table looks like


Does anyone solve this or could help me ?
(sorry if my English is not so clear. I’m an Brazilian who is trying his best here)

A couple things:

  • Your script will update every single record one at a time, which is inefficient, regardless if those records changed
  • The script copies each record’s own ID into its link field, meaning it links records to themselves. This is not what you want: you are trying to link records to different records in another table
  • The script is not reliant on the date being the primary field. If you were to use a script, it would need to find records in Properties that have a matching date and find those record’s IDs.

It sounds like you just want to copy the {Source Date} field into the {Dates Link} field whenever the {Source Date} value changes. This doesn’t require a script.

Set your Automation trigger to be whenever a Properties record’s {Source Date} is updated. Then have an Update Record step set up like this:

1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.