Notifications
Announcements
No record found.
Despite the description here:https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/formcontext-data-entity/save
it seems that the formContext.data.entity.save() method is no longer synchroneous:
I do realize that this method is deprecated in favor of formContext.data.save() but just changing it to async is quite troublesome to some code that has not been revised to comply with this change yet.
Can anyone tell me if this is a bug or if it has been announced anywhere?
I'm not too sure about the old legacy save method but if you've got the old synchronous save method in a function, you can just can just add "async" in front of your function name and use the "await" syntax in front of the new save method. This kinda mimics/writes out a async method in a synchronous way meaning it might not break/need to revise your current code which is written in a synchronous method.
Obviously this is ES6 code so might not work if alot of users use IE.
So example below:
async function testFunction(executionContext) { var formContext = executionContext.getFormContext(); var exampleField = formContext.getAttribute('new_testfield').getValue(); await formContext.data.save(); //The await in syntatic sugar masking async method as a synchronous method //Perform the rest of your synchronous script here }
Thx Mike. That is exactly how I solved it :-)
My concern - and the reason I posted the question - is "how do I avoid being a victim of changes of the behavior of API calls without knowing it?"
The call is clearly not behaving as the documentation states, so has there been a post from MS somewhere regarding this?
I hope some MVP or product manager at MS will give an answer
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Tom_Gioielli 72 Super User 2025 Season 2
Daniyal Khaleel 32 Most Valuable Professional
Gerardo RenterÃa Ga... 29 Most Valuable Professional