Apr 04, 2022 09:30 AM
I would like to build an automation script that deletes the record after 14 days of being done.
Status = done
Table Name = Onboarding Status
Solved! Go to Solution.
Apr 05, 2022 12:12 AM
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:
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
Apr 04, 2022 11:16 AM
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"
)
)
Apr 05, 2022 12:12 AM
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:
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
Apr 05, 2022 06:23 AM
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”
Apr 05, 2022 06:58 AM
hi @Jesus_Yanes,
understood, in that case you should set the automation in the way I am showing in this screenshot:
Hope this helps!
Website: alessiomonino.com
Calendly: Calendly - Alessio Monino
Email: alessio.monino@gmail.com
Apr 05, 2022 01:04 PM
This is perfect, thanks Alessio this worked great.
Apr 05, 2022 11:45 PM
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