web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

It seems that formContext.data.entity.save(saveOption) is no longer synchroneous

(0) ShareShare
ReportReport
Posted on by 70

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:
pastedimage1621330297217v1.png

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 have the same question (0)
  • Suggested answer
    MikeC282 Profile Picture
    2,175 on at

    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
        
    }

  • Jacob Blom Andersen Profile Picture
    70 on at

    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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 72 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 29 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans