06-29-2022 11:30 AM
Await / Async is built on promises and is a clean way to represent asynchronous processes in a synchronous way. In Dynamics 365 async and await are used especially while working with web api calls so that until promise gets completed other part of the code will not get executed. As an example, on selected contact record this behaviour was shown .
English version of Blog :
https://venkatasubbaraopolisetty.com/2022/06/29/back-to-basics-61-usage-of-async-and-await-with-webr...
Thanks for watching. You can find me in the following places:
🎯 Website: https://venkatasubbaraopolisetty.com/
🎯 Twitter: https://twitter.com/Venkata48681009
🎯 LinkedIn: https://www.linkedin.com/in/venkata-subbarao-polisetty-mvp-mct-54116618/
watch?v=28omPKIjMwU
I have written a simple code to test ASYNC and AWAIT on my PowerApps environment. It is as seen in below code. Display function has been placed onSave of Form.
Unfortunately when i execute below code system does not stop saving the record.
I have referred following links too.
https://debajmecrm.com/are-you-using-async-functions-in-your-webresources-yet-in-dynamics-365-they-c...
https://debajmecrm.com/how-to-make-xrm-webapi-calls-synchronous-in-dynamics-365-cds/
https://debajmecrm.com/async-onsave-handlers-in-dataverse-dynamics-365-forms-to-cancel-save-operatio...
Try to use delay functionality with setTimeout() function
They delay too can be set for a maximum of 10 seconds as I understood from some community posts.