Skip to main content

Hello,


I do not have a lot of programming knowledge so Im struggling with something that I think is quiet easy, but I could not find the answer online (at least not an easy one).


I would like to create a script that I could run on demand to check all the boxes if Label contains “Roadmap-visible”


Something like if Label contains “roadmap-visible” then checkbox = true



I know it is easy to do it with automation and I have already done it but I would like to do it with a script because it is more practical to run the command on demand.


Thanks a lot for your help 🙂

Since the value for all the affected fields is being changed to the same thing, it would be most convenient to change the values of a whole View at a time.


Create a view that filters records to ones where “Roadmap-visible” is one of the selections.


Then make your script:


let table = base.getTable("Table Name");
let view = table.getView("View Name");
let query = await view.selectRecordsAsync({fields: d]})

let updates = query.records.map(r => {
return {id: r.id, fields: {"Checkbox": true}}
})

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

Reply