Help

Discover what data silos are costing your org in our commissioned Forrester study. Learn more

Delete a record by automation script

Topic Labels: Automations
Solved
Jump to Solution
277 6
cancel
Showing results for 
Search instead for 
Did you mean: 

I would like to build an automation script that deletes the record after 14 days of being done.
Status = done
Table Name = Onboarding Status

image

1 Solution

Accepted Solutions

hi @Jesus_Yanes,
just building up on @kuovonne’s contribution, after you have created the formula field, you can use it to build the following automation with a script. I am attaching screenshots of the automation below:

Screenshot 2022-04-05 at 9.09.46 AM
Screenshot 2022-04-05 at 9.08.05 AM

Script:

let table = base.getTable("Onboarding Status")

await table.deleteRecordAsync(input.config()['target_record_id']);

Hope this helps!

Website: alessiomonino.com
Calendly: Calendly - Alessio Monino
Email: alessio.monino@gmail.com

See Solution in Thread

6 Replies 6

You could have a formula field that states how many days a record has been done. Then trigger the automation when the record has been in that state for 14 or more days. If you don’t know how to write an automation script to delete a record, you can buy my automation helper scripts.

IF(
  {Status} = "Done",
  DATETIME_DIFF(
    TODAY(),
    LAST_MODIFIED_TIME({Status}),
    "days"
  )
)

hi @Jesus_Yanes,
just building up on @kuovonne’s contribution, after you have created the formula field, you can use it to build the following automation with a script. I am attaching screenshots of the automation below:

Screenshot 2022-04-05 at 9.09.46 AM
Screenshot 2022-04-05 at 9.08.05 AM

Script:

let table = base.getTable("Onboarding Status")

await table.deleteRecordAsync(input.config()['target_record_id']);

Hope this helps!

Website: alessiomonino.com
Calendly: Calendly - Alessio Monino
Email: alessio.monino@gmail.com

Hi Alessio -

This worked, but it automatically deleted the record, instead of respecting the 14 day rule.

IF(
{Status} = “Done”,
DATETIME_DIFF(
TODAY(),
LAST_MODIFIED_TIME({Status}),
“days”
)
)

I named the above formula Column “Record Deletion Formula”

hi @Jesus_Yanes,
understood, in that case you should set the automation in the way I am showing in this screenshot:

Screenshot 2022-04-05 at 3.57.22 PM

Hope this helps!

Website: alessiomonino.com
Calendly: Calendly - Alessio Monino
Email: alessio.monino@gmail.com

This is perfect, thanks Alessio this worked great.

hi @Jesus_Yanes,
sounds great! Feel free to mark my relevant post as the solution so others with your same question can refer back to it in the future

Website: alessiomonino.com
Calendly: Calendly - Alessio Monino
Email: alessio.monino@gmail.com