Developer forum

Forum » Integration » ODataV4 - 'Last_Date_Modified' from BC does not include the time

ODataV4 - 'Last_Date_Modified' from BC does not include the time

Jon Thorne
Jon Thorne
Reply

Hi,

In the OData received from the CustomerCard (and perhaps others), the 'Last_Date_Modified' only has the date and not the time value. When we use the source mode 'Data replication' it adds a modified filter which includes the time for this field. The resulting filter does not show any records edited on the same/current day as the date is the same and not 'gt'. This means that updates may never be picked up if this activity is run more than once a day. Is there a setting in BC or in the DW plugin unit that can change this? Or is this a bug in the codeunit?

Regards, Jon.

Screenshot_2022-06-11_at_8.37.17_pm.png Screenshot_2022-06-11_at_8.38.00_pm.png

Replies

 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply

Hi Jon,

 

Seems like you are correct.

I'll have a deeper look into it and fix this BUG :)

Thanks for sharing!

BR

Matthias Sort

 
Jon Thorne
Jon Thorne
Reply

Hi Matthias,

I found another bug while you are at it with OAuthV4 and OAuth2. If you use OAuth2 authentication and ODataV4 export the "application/json' Content-Type headers are not sent with the POST and PATCH. And therefore are invalid. So you cannot update anything with OAuth2 and ODataV4.

See EndpointDestinationWrite.cs:

if (endpointAuthentication.Type == EndpointAuthenticationType.OAuth2)
            {
                string token = OAuthHelper.GetToken(endpointAuthentication);
                if (!patch)
                {
                    awaitResponseFromBC = _client.PostAsync<string, T>(URL, jsonObject, token);
                }
                else
                {
                    awaitResponseFromBC = _client.PatchAsync<string, T>(URL, jsonObject, token);
                }
            }
            else
            {
                if (!patch)
                {
                    awaitResponseFromBC = _client.PostAsync<string, T>(URL, jsonObject, endpointAuthentication, header);
                }
                else
                {
                    awaitResponseFromBC = _client.PatchAsync<string, T>(URL, jsonObject, endpointAuthentication, header);
                }
            }
 
Regards,
Jon.
 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply

Hi Jon,

Sure I'll fix that one too.. although the header is added somewhere else.. but after a local test on an export I can see that there is something wrong :)

BR

Matthias Sort

 
Jon Thorne
Jon Thorne
Reply

Hi Matthias,

Sorry, one more to look into. For some reason the SQL command parameter does not work in the function "GetAllUserNamesFromUserGroup" in ODataDestinationWrite.cs

When trying to find all the users in a group this is not giving me any results. When I put the parameter directly in the query it works correctly. This was causing me issues on OData importing udpated customer data. I am not sure exactly what is wrong with the parameter in the query as it should work. Please check if this is a similar issue for you.

Regards,

Jon.

 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply

Hi Jon

Why not fix it all when looking into the area :)

I'll see what I can find :D

BR

Matthias Sort

 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply

Hi Jon,

Seems like i made it work..

The changes are sent to code-review.. so hopefully the fixes will be ready for you soon.. :)

I'll post again, in here, once the nugets are released and ready for you to download :)

BR

Matthias Sort

 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply

Hi Jon,

Seems like the versions now have been released.

OData Provider -> https://www.nuget.org/packages/Dynamicweb.DataIntegration.Providers.ODataProvider (version 0.2.20)

Endpoint Provider -> https://www.nuget.org/packages/Dynamicweb.DataIntegration.Providers.EndpointProvider (version 0.2.24)

BR

Matthias Sort

 

You must be logged in to post in the forum