D365 Finance & Operations and Dynamics AX Forum

Expand all | Collapse all

Not getting most recent data updates from D365FO using Microsoft OData Client

  • 1.  Not getting most recent data updates from D365FO using Microsoft OData Client

    Posted 14 days ago
    Our application runs as a windows service using the Microsoft.Odata.Client to retrieve data from D365FO.  When we make a call to retrieve data we are not getting returned the most recent updates.  For example, we make a call to retrieve a Customer, then we go into the D365FO UI and update data on that Customer. We make a second call to D365FO but we are not getting back the updated data.  We get back the same data as was retrieved from the first call.  It is like it is caching the information and not going back to get fresh data.  When we restart the service we then get the updated data.

    Any guidance on this would be greatly appreciated.

    #FinanceandOperations

    ------------------------------
    Linda Knecht
    ITW / Hobart
    Troy OH
    ------------------------------
    Conference-AXUG_200x200


  • 2.  RE: Not getting most recent data updates from D365FO using Microsoft OData Client

    TOP CONTRIBUTOR
    Posted 13 days ago
    If your accessing via a data entity directly using OData, there should not be any staging table involved.

    However, some integrations are built such that they access a changeset provided by change tracking on an entity. If the app is not acknowledging the changeset after retrieving it, you would see the behavior you describe. AX returns the same changeset until acknowledged.
    I assume during the restart of the service in this scenario you end up resetting the change tracking somehow - thus allowing you to see the newer data.

    I would strongly suggest having the programmer involved setup postman to inspect the calls being made.

    ------------------------------
    Tony Zeigler
    Senior Consultant
    Strategic Solutions NW, LLC
    Beaverton OR
    ------------------------------

    Conference-AXUG_200x200


  • 3.  RE: Not getting most recent data updates from D365FO using Microsoft OData Client

    Posted 11 days ago
    Hi Tony thank you so much for responding.  I set up fiddler to monitor the traffic going to my D365 dev box and I do see the request and response I sent via the .Net application. The request has the normal OData query string values and the response has returned only the fields I requested in the $select parameter.  I don't see anything else pertaining to change tracking.  What should I be looking for?  We are in the implementation phase of moving from DAX 2009 to D365FO.  We are using out of the box entities, no custom entities. When I go into Data Management the Data Entity "Customer V3" has Change tracking set to false.

    ------------------------------
    Linda Knecht
    ITW / Hobart
    Troy OH
    ------------------------------

    Conference-AXUG_200x200


  • 4.  RE: Not getting most recent data updates from D365FO using Microsoft OData Client

    TOP CONTRIBUTOR
    Posted 11 days ago
    If your using Postman, a call to fetch directly from an entity would look like a get in this format:
    {{resource}}/data/TaxGroups?$format=json
    I'm not aware of anything that would cause this to not get the latest data.

    If your using Postman, a call to fetch the results of a recurring integration your hitting a different endpoint, like this:
    {{resource}}/api/connector/dequeue/3CD35414-53E8-404D-A363-890130CF2D17

    (Note - the ID at the end comes from the UI where you setup the recurring data job - screenshot courtesy of our internal Documentation)

    That would then give you a link in it's response that let's you download the changeset (review the response's DownloadLocation field)

    Once you've processed the changeset, you need to reply with a post in this format to acknowledge that you've got it and are ready for the next changeset:
    {{resource}}/api/connector/ack/3CD35414-53E8-404D-A363-890130CF2D17

    The {{variable}} syntax is postman syntax for using a variable. In the case above, {{resource}} is the variable holding the root url for my environment.

    Also - I should give credit for the changeset documentation to my co-worker, JB :)

    ------------------------------
    Tony Zeigler
    Senior Consultant
    Strategic Solutions NW, LLC
    Beaverton OR
    ------------------------------

    Conference-AXUG_200x200


  • 5.  RE: Not getting most recent data updates from D365FO using Microsoft OData Client

    Posted 11 days ago
    Hi Tony thank you again.  The issue of not getting back the latest data is only occurring in the .Net windows service application. Let me clarify.

    1) Start debugging the Windows Service
    2) Application makes a request to retrieve a record from D365FO using Microsoft.OData.Client
    3) Update the same record retrieved in Step 2 via the D365FO UI
    4) Application makes a request to retrieve the same record from D365FO using Microsoft.OData.Client >> data returned does not have the updates made to the record.
    5) Make the same OData request via the browser  >> data returned has the updated data.


    ------------------------------
    Linda Knecht
    ITW / Hobart
    Troy OH
    ------------------------------

    Conference-AXUG_200x200


  • 6.  RE: Not getting most recent data updates from D365FO using Microsoft OData Client

    TOP CONTRIBUTOR
    Posted 10 days ago
    Linda -

    I think I understand what you've described. The Postman tool I described in my previous post is simply how I test endpoints. Your use of Fiddler may be similar - although Fiddler is more of a packet sniffer, where postman allows you to interactively make a call to an endpoint and see the the raw data returned.

    If you have a programmer who has written a .net app, which in turn is using the Odata endpoints, then my previous post is just trying to identify which exact endpoint are they using. So in fiddler, if you can see the url they are hitting, you can compare that to what I was describing in Postman to get an idea of what the .net programmer used programatically.

    If your fiddler shows the .net app is accessing a url that looks like this:
    {{resource}}/api/connector/dequeue/3CD35414-53E8-404D-A363-890130CF2D17
    then they are probably missing the ack response.

    If your fiddler shows the .net app is accessing a url that looks like this:
    {{resource}}/data/TaxGroups?$format=json
    then they are probably doing some caching locally .net that they should not be. In this case, you probably won't see a 2nd call to the endpoint in fiddler when you expect it.

    Tony

    ------------------------------
    Tony Zeigler
    Senior Consultant
    Strategic Solutions NW, LLC
    Beaverton OR
    ------------------------------

    Conference-AXUG_200x200


  • 7.  RE: Not getting most recent data updates from D365FO using Microsoft OData Client

    TOP CONTRIBUTOR
    Posted 10 days ago
    Interesting - it does sound like it's accessing the data entities directly via OData - so if there is caching we may need to verify what layer is doing the caching. My first suspect would be the AOS table caching. To verify, go to System Administration/Setup/Data Cache/Data Cache Parameters.
    Just disable it temporarily and run a test to see if that fixes the issue. If it does, you may want to dive a bit deeper about why the cache isn't being invalidated when the data changes. If this was AX2009, that could happen by running sql updates directly against the database.

    ------------------------------
    Tony Zeigler
    Senior Consultant
    Strategic Solutions NW, LLC
    Beaverton OR
    ------------------------------

    Conference-AXUG_200x200


  • 8.  RE: Not getting most recent data updates from D365FO using Microsoft OData Client

    Posted 12 days ago
    This does sound like your service is caching. Restarting it shouldn't impact anything on the D365 side, only locally. Checking to be sure your service doesn't have any caching enabled, either in local code or at the server level, would be my first step. Then checking on any network appliances between your call app and the service, and the service and D365 (seems less likely to be your culprit as a service restart clears it up). Having caching of same queries enabled would cause what you're seeing.

    ------------------------------
    Brent Hawthorne
    Sr Manager of Application Development
    Daisy Brand
    Dallas TX
    ------------------------------

    Conference-AXUG_200x200


If you've found this thread useful, dive deeper into User Group community content by role