Add Variable to success event handler

Hi everyone,

I am a bit stuck on my last function before I can share the new dashboard with my team.

I've created a file upload for multiple images, those images get listed below the upload field then (List component) and there the user can change the name and upload the images one by one.

For the upload I pass the "i" position in the results list to the query using additionalScope and it works perfect.

After the successful upload of the image, I want to first hide the upload button and then I need a second query which adds the selection of the user for the image to a separate database. But when I pass the "i" within the success event, its always "null".

So why can I use the additionalScope variable within the upload itself, but not within the success events on that query, any ideas or a workaround?

image

It always hides only the first upload button (probably because the value of i=null within the success handler, but not on the upload query itself, it always uploads the correct image.

Edit: I've got all my knowledge about the upload of multiple files from this guide

Hey @G1ofG3!

Extending additionalScope to the event handlers for a query is something the dev team is currently looking into. For the moment, can you try defining the handler in the script itself? Something like:

upload_file.trigger({
  addtionalScope: {
    i: i,
  },
  onSuccess: () => save_file[i].setHidden(true);
});
1 Like

Thank you, that actually helped me a lot!