Did you already fix the problem reported on this topic
Pass AdditionalScope to onSuccess (or onError) handlers - Feature Requests - Retool Forum
I test I did not have access to additional scope vars in OnSuccess handler.
Hugo
Did you already fix the problem reported on this topic
Pass AdditionalScope to onSuccess (or onError) handlers - Feature Requests - Retool Forum
I test I did not have access to additional scope vars in OnSuccess handler.
Hugo
Anyone can help me?
Hey @Hugo_Marques,
Thanks for flagging! Apologies for the confusion, it looks like this wasn't fully implemented yet. There was a miscommunication on the feature request, and while we did ship a bug fix with additionalScope, the request for passing additionalScope to success/failure events is still outstanding
I will try to bump the request internally
My suggestion, is to trigger all of your queries from a single JS query. That way, the additionalScope value is in scope to pass to all subsequent queries, and you can use onSuccess or onFailure within in the JS query to chain them together: https://docs.retool.com/apps/scripting-events/guides/javascript#trigger-a-query
+1
I just stumbled upon this limitation today.
The suggestion of putting everything in one script brings in the (unwanted) complexity of how to wait for queries to complete before executing following lines.
Edit: it's actually not that hard! See next post....
Thanks for chiming in! For an update, we are still tracking +1s here, but this request is currently in our backlog
In my case I'm using additional scope to send the index number of a table in an expanded row to the query updating that table.
The problem then came of how to clear the changesetArray, because the Success handler didn't have that index number so didn't "know" which table to act on.
The solution was to move the clearChangeset() call to the onclick action of the button which calls the query to make the update, because there index number of the table is available to both..
(ie switch from onclick query call to JS scipt and in the script call the query and then .clearChangeset()
The problem then (I thought) was how to make the Javascript wait until the query was completed before calling .clearChangeset() .
It turns out to be easy because Retool Javascript execution apparently takes care of a lot of the behind the scenes asynch issues.
So all it takes is to put an "await" infront of the call to the query.
await queryUpdatePrice.trigger
(
{additionalScope: {indexToUpdate: i}},
);
table28[i].clearChangeset();