Update multiple rows

Hi. I'm trying to change the role of multiple roles (users) in my query at once. I'm having two problems.
The first is mapping the rows by their primary key (i.e. ID). It doesn't seem to be returning an array but the formatDataAsArray method didn't work either.
The second is figuring out how to either loop through the array of primary keys or use them all to update every row based on it. I'm attaching a screenshot of where I'm at now.

Thanks!

I don’t think that you can assign variables in the inline brackets like that. Since you’re already creating an array with the map function, just use that directly.

{{dataTable.selectedRows.map(id=>{id, role: assignRoleOptions.value})}}

I’m on my phone so I haven’t tested it but that should do ya.

Hi, I tried that but it kept throwing different JS errors. This is where I'm at now:

Sorry, the errors are because I gave you bad code. :slight_smile:

dataTable.selectedRows.map(row=>({id: row.id, role: assignRoleOptions.value}))