Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Update method in Data Entity

Posted on by 362

Hi All,

I am trying to understand the difference between update() and UpdateEntityDataSource() methods on the data entity.Could you please explain when to override update() and when to override updateEntityDataSource().

Thanks

Venky

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,188 Most Valuable Professional on at
    RE: Update method in Data Entity

    update() is called to update the whole entity. It internally calls many other methods, including updateEntityDataSource() for each data source.

  • Suggested answer
    Satish Panwar Profile Picture
    Satish Panwar 14,645 on at
    RE: Update method in Data Entity

    Hi Venkat,

    Try using updateEntityDataSource method always unless this method can't solve something that you can only do via update(). This will make sure your code is always in one place and you don't have to juggle between where and why. Going forward, if you want to add data source, you won't have to move your code around to account for another data source.

    pastedimage1573493487592v1.png

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Update method in Data Entity

    It depends on your functional requirement = if you want to react to update on the entity level or single data source level.

    If you have one data source you could use either one.

  • Venkatdax0 Profile Picture
    Venkatdax0 362 on at
    RE: Update method in Data Entity

    Thanks Nikolaos. So if we have one datasource only in the entity i understand that we can write logic in insert/update and if we have multiple datasources we need to write the logic in insertentitydatasource/updateentitydatasource by respective datasource name. Please correct me here

  • Verified answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Update method in Data Entity

    Update method is not related to any one data source.

    UpdateEntityDataSource is related to specific data source.

    Perhaps this helps you decide where to put your code?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans