Help

Moving records from one table to another using checkbox

Solved
Jump to Solution
3427 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Daniel_Sandoval
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello everyone, I am wondering if there is a way to use the checkbox field to move lines to a new table once checked. I have a table of current inventory, I have a form linked to this inventory list so colleagues can see the inventory and request accordingly. Once the inventory is depleted I would like to just use the checkbox to trigger the line to move to a different table of depleted inventory. I have used the VIEWS function to filter the depleted inventory out of my view, but in this case the depleted inventory still will show up on the linked form that others use. I am currently just manually cutting and pasting the lines in the new table. TIA

1 Solution

Accepted Solutions
Zollie
10 - Mercury
10 - Mercury

If you’d like it to occur exactly as you’re describing it, you’ll need the help of some sort of third party tool (integrations and/or the API) that would add/remove records as directed or the scripting block as described below.

But using vanilla Airtable, it looks like the form can limit linked records to a view. You can access these settings with an extra click on the linked record in the form configuration menu. Does that help?

Screen Shot 2020-02-12 at 11.34.22 AM

See Solution in Thread

3 Replies 3
Zollie
10 - Mercury
10 - Mercury

If you’d like it to occur exactly as you’re describing it, you’ll need the help of some sort of third party tool (integrations and/or the API) that would add/remove records as directed or the scripting block as described below.

But using vanilla Airtable, it looks like the form can limit linked records to a view. You can access these settings with an extra click on the linked record in the form configuration menu. Does that help?

Screen Shot 2020-02-12 at 11.34.22 AM

Hi @Daniel_Sandoval - I agree with @Zollie on this one. Limiting the view in the form is the “right” way to go. Generally, I would keep things of the same type in the same table (but adjust status or something else to indicate they are old or otherwise not needed).

That said, there is a case for archiving and with the new Scripting beta block this can be done.

This script:

let table1 = base.getTable("Table1");
let table2 = base.getTable("Table2");
let result = await table1.selectRecordsAsync();
for (let record of result.records) {
    if (record.getCellValue("Move to Table2")) {
        await table2.createRecordsAsync([
            {
                fields: {
                    'Name': record.getCellValue("Name")
                },
            }
        ]);
        await table1.deleteRecordAsync(record.id);        
    }
}  

will move the selected items from Table1 to Table2 when run:

Screenshot 2020-02-12 at 19.23.39

Screenshot 2020-02-12 at 19.24.07

Screenshot 2020-02-12 at 19.24.13

I think the new scripting block is going to be really useful

JB

This works perfect! idk how I missed that option when making the form. Thank you so much!