Help

Re: Select Multiple Records and Update

Solved
Jump to Solution
2523 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Currently_Jason
6 - Interface Innovator
6 - Interface Innovator

HI,

I want to be able to select multiple records in a base and update a field in all selected records. I’m thinking this will probably need a script where I can enter a value and then push a button to update all selected records with that value.

Has anyone done this or have an idea to get me started please?

Thanks

1 Solution

Accepted Solutions

Ah, yes, that does complicate matters.

I’ve created a solution here, and you can view the script by duplicating the base.

gif5

This seems like overkill, but yeah I totall get what you mean when you say it’s for a client.

===

Do you think they’d be able to handle the following?

  1. In the linked field, click the “+” icon
  2. Select the field I want to link it to
  3. Press “CTRL + C”
  4. Select the other records I want to update, press “CTRL + V”
    gif3

See Solution in Thread

7 Replies 7

Hi Jason, chances are you already know about good old shift and click to select multiple records and then paste (gif below), as well as Airtable’s Batch Update App, so I take it there’s something specific you’re trying to do that it can’t achieve?

gif2

If you could give me a specific example of what you’re trying to do I would be happy to try to help

Hi Adam,

Thanks for for responding. It’ a little more complicated than that.

I have records, in a view, that need assigning to a project via a linked record field. When a record is added to a project i.e. the linked filed has a value, then the record disappears from the view due to the filter on the view.

Ideally I want to link one record to a view and then drag this value (or copy and paste) to other records that need assigning to the project. The problem is the record disappears when it is added to a project, so not there to drag the value to the other records.

I know there are work arounds but its for a client and I want to make it easy as possible so envisioned an option to select a bunch of records and then select a project and update them all.

Hope this makes sense

Ah, yes, that does complicate matters.

I’ve created a solution here, and you can view the script by duplicating the base.

gif5

This seems like overkill, but yeah I totall get what you mean when you say it’s for a client.

===

Do you think they’d be able to handle the following?

  1. In the linked field, click the “+” icon
  2. Select the field I want to link it to
  3. Press “CTRL + C”
  4. Select the other records I want to update, press “CTRL + V”
    gif3

Hey Adam, thanks you so much. I really appreciate it and this is exactly what I was looking for. Awesome!!

NickTheYits
4 - Data Explorer
4 - Data Explorer

I had the same issue, especially when the field I wanted to update was used to filter the data as well!

My solution is not the best, but works for me. I created a separate checkbox column to select the rows I want to update. I also created a new view with only one filter → "checkbox is ✔". This way I can select the rows I want, move to the "Checkbox View" make any changes without the filtering getting in the way, and then return to my other view where I can also easily uncheck the previously selected rows.

I hope this helps 

Hi there thanks for this it's what I'm looking for but when I go to duplicate the base it says I don't have permissions to create automations?

Hmm, it sounds like you may not have duplicated the base to your own workspace, here's a guide: https://support.airtable.com/docs/creating-a-new-empty-base#duplicating-airtable-bases

I'm also using a script extension and not an automation, and I've attached the code below.  Script extensions used to be available on the Free plan but are now restricted to paid plans, thus the confusion, sorry about that!

let projectTable = base.getTable("Projects")
let projectTableQuery = await projectTable.selectRecordsAsync({})
let projectRecord = await input.recordAsync('Pick the project', projectTableQuery);

let table = base.getTable("Records")
let checkboxField = table.getField("Checkbox")
let fieldToUpdate = table.getField("Linked")

let query = await table.selectRecordsAsync({
    fields:[checkboxField]
})

let recordIdsToUpdate = new Array;

for (let record of query.records){
    if (record.getCellValue(checkboxField) === true){
        recordIdsToUpdate.push(record.id)
    }
}

let updates = new Array;
for (let id of recordIdsToUpdate){
    updates.push({
        id: id,
        fields:{
            [fieldToUpdate.id]: [{ id: projectRecord.id }],
            [checkboxField.id]: false
        }

    })
}

while (updates.length > 0) {
    await table.updateRecordsAsync(updates.slice(0, 50));
    updates = updates.slice(50);
}