Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to make a Dynamic Action wait for an async callback

av84funMay 12 2022

Apex 21.2 - I have a dialog form to create/edit shipping addresses. When a new shipping address is added/changed and the submit button is clicked, I want to use the Google Maps API distanceMatrix to retrieve mileage to the destination from our warehouse and save the value in the P27_Distance field prior to the submit.
I have DAs setup on the CREATE and SAVE buttons to execute a SetValue Javascript Expression followed by a Submit Page. "Wait to finish" is selected but the submit occurs before the setValue has completed the callback.
I have tried using async/await with promises but the value is set to [object] promise. Of course the SQL fails because the field is not numeric.
How can I make the setValue wait until the google service has responded before processing the submit? Is there a better way to approach this?

Comments
Post Details
Added on May 12 2022
3 comments
1,299 views