Nov 22, 2023 05:41 AM
Hello!
I am just starting out with AirTable and I am trying to create an automation that when an item is moved to the status "Backorder" (this should happen when the field "B/O Qty" is greater than 0) in my "Open Orders" project, it is then duplicated into another project called "Backorder Clip". Once the order status is not "Backorder" anymore (or the B/O Qty goes to 0), it should be deleted from the "Backorder Clip" project and moved to the "Not Started" status in my "Open Orders" project. I can't seem to figure out exactly how to achieve this. Any help is greatly appreciated. Thanks so much!
Nov 23, 2023 03:41 PM - edited Nov 23, 2023 03:41 PM
It seems like you need 2 sets of automations. Though, I don't have a full grasp on what you're trying to achieve, here's what I came up with from my understanding. Please clarify if I'm not on the right track.
1. Duplicating to "Back Order" Table.
I assume you have the same fields in both your "Backorder Clip" & "Open Orders" tables. I also assume you want to create a new record in the "Open Orders". If you want to just update existing records in "Open Orders" we can also do that but it'll take a few more steps in the automation. I will also assume you have your "Not Started" as a single select and would also want that to auto-change to something like "In Progress".
Trigger: When record matches condition
Action: Update Record
Action: Create New Record
2. Deleting and set to "Not Started"
Trigger: When record matches condition
Action: Update Record
Action: Find Records
Advance Logic: Repeating Step
Action: Run a Script
let table = base.getTable("Open Orders");
let inputConfig = input.config();
let recordId = inputConfig['Delete Me']
await table.deleteRecordAsync(recordId);
You will also need to define which records are "Delete Me" as the ones from the repeating step. If you open up the script you should see a panel on the left that will let you do this. Remember to name these as "Delete Me" so it matches the code.
Let me know if this is what you're looking for.