Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Suggested answer

RowVersion on Unified Interface

Posted on by 5

Hi,

I would like to know if after Unified interface transition there is a way to achieve the entityRowVersion on WebResources, as could be done before with: "window.parent.Xrm.Page.data.entity.getRowVersion()"? Thx


Categories:
  • Suggested answer
    miguelbeja Profile Picture
    miguelbeja on at
    RE: RowVersion on Unified Interface

    Hi, RowVersion for OrganizationService is still going to work. What you mentioned in the beggining was regarding JavaScript for WebResourecs right?

    Not sure if the Etag is going to be the same but you can test it.

    docs.microsoft.com/.../entity-operations-update-delete

    For Plugin you need to do the UpdateRequest or DeleteRequest and take into consideration doing this:  ConcurrencyBehavior = ConcurrencyBehavior.IfRowVersionMatches.

    The documentation above has sample.

  • RE: RowVersion on Unified Interface

    Thx Miguel Beja,

    Can you tell me if the mentioned ETag can be used also with .NET OrganizationService (Microsoft.Xrm.SDK) ? My API is using it to update entities and I would like to keep using it.

  • Suggested answer
    miguelbeja Profile Picture
    miguelbeja on at
    RE: RowVersion on Unified Interface

    Hi Alexandre,

    Like Henry mentioned, looking into the documentation Client API Reference for model-driven apps - Power Apps | Microsoft Docs it isn't being referenced in any place about getRowVersion() for the Xrm.Page, which means it is an internal function that was accessible in WebClient but not anymore in Unified interface and it was being used in an unsupported way.

    I would recommend you to have a look into this https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/perform-conditional-operations-using-web-api#apply-optimistic-concurrency and apply this new kind of logic to your development.

    When a User opens a record you should get that "@odata.etag": "W/"470867", when the user changes and submits it, you should add to the request the If-Match on the update request, then it can be validated if the user is updated "his" version of the record, if it fails, then it isn't the same version.

    pastedimage1607960072908v3.png

    Retrieve an account sample:

    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/retrieve-entity-using-web-api#retrieve-specific-properties

    pastedimage1607959972429v1.png

    You also need to be sure that the Entity has Optimistic concurrency enabled

    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/perform-conditional-operations-using-web-api#entity-must-have-optimistic-concurrency-enabled

  • RE: RowVersion on Unified Interface

    I am using RowVersion property for concurrency purposes. I pass the rowVersion value in a HTTP request, and so my API can then compare when trying to get/update the entity record if no changes occurred since the HTTP request was performed.

  • Henry J. Profile Picture
    Henry J. 5,235 on at
    RE: RowVersion on Unified Interface

    The getRowVersion Client API isn't documented (and so is unsupported).

    Can you share a bit more on why you're using it?

  • RE: RowVersion on Unified Interface

    Thx for feedback Henry Jammes.

    My concerns are about parent.Xrm.Page. Altough it will continue to work, the information that can be obtained using it got some modifications, and now I can't find a way to get the rowVersion information as I could do previously with "window.parent.Xrm.Page.data.entity.getRowVersion()".

  • Suggested answer
    Henry J. Profile Picture
    Henry J. 5,235 on at
    RE: RowVersion on Unified Interface

    Hi Alexandre,

    What exactly are you trying to achieve?
    Does it have to do with grids and subgrids? If yes, the supported Client APIs are documented here:
    Grids and subgrids in model-driven apps for Dynamics 365 - Power Apps | Microsoft Docs

    If it's more about Xrm.Page, although it is deprecated, parent.Xrm.Page will continue to work in case of HTML web resources embedded in forms as this is the only way to access the form context from the HTML web resource:
    Important changes (deprecations) coming in Power Apps, Power Automate and customer engagement apps - Power Platform | Microsoft Docs

    Henry

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,326 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,166 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans