Trigger Query Update for each element of nested array


I need to run an update query but i only want to update 250 records each time (long story - dont ask). So each one would need to run - then the next one and so on.
Anyway I have my update query, and my idea is to have a little script that pulls in the id's that need to be updated, and puts them into an array of 250 long, and then each of these gets pushed to a main update array.
I then use map on this to trigger the query of each element in the array, but i must be missing something in my setup, can anyone advise:

My Update Query:

UPDATE visitors
SET join_date=date_add(join_date, INTERVAL {{updateDays.value}} day) 
WHERE group_id={{groupListEU.selectedItem.group_id}}
AND id={{listUpdateData}} -- should be getting this from the calling script?

The Script id like to call the query:

const listCoursesForUpdate =; // pull in the list of Id to be updated
const updateList = []; // list to push each 250 block into.
let nestedList = [];
const query = UpdateCourses;

for (let item of listCoursesForUpdate) {
  if (nestedList.length >= 250) {
    nestedList = [];

const promises =>{
  return query.trigger({
    additionalScope: {
      listUpdateData: data // assign the data to the courses variable to be used in the query - data will be each nested array inside of the updateList array

return Promise.all(promises)

Anyone see anything wrong with what im trying to do here - it's not working but im getting no sign of any errors in the debug tools. The update query will work if I manually add in the id's - I just dont think it is getting the id's to update from the script, so im probably doing that part wrong

I needed to do something similar recently, and this thread / post is basically what I ended up doing.

Thanks benbarry - that worked a treat for me