Wait until update completes to trigger a query to refresh a checkbox group

I have a modal the allows a user to add an item to (a table that will make it show up in...) a checkbox group. Once the "save" button is clicked, a JS Query runs. The JS Query triggers a JS Query to create the update array. Then it triggers the update query. Then is closes the modal and triggers the query that populates the checkbox group.

The problem is that the last trigger (for the Query to update the checkbox group) runs but doesn't seem to include the newly created record.

I think the query that updates the checkbox group is running before the update query finishes.

How do I get the triggers to complete before the next query runs?

This is what I have currently.

(async () => {
await js_make_staff_to_add_array.trigger({onSuccess:function(staff_data) {update_add_staff_to_area.trigger({additionalScope: {staff_array: staff_data}})}})
await modal_add_staff_to_area.close()
await qry_Area_Crew.trigger()
})();

Thanks

Check the order of your event handlers and maybe chain that query that borks to be delayed by chaining to the one that comes before it. The query that comes before it can set the delay under Advanced tab and set the borked query to run manually if it is not already. You should not have to write delay script that’s what this platform does for you