8
In business central, new functionality regarding how to filter what to synchronize was introduced.
This case will regard synchronize customers _from the integration table_, but in my honest opinion this should be change when the direction is bidirectional as well.
The current OnRun function looks like this:

if Direction in [Direction::ToIntegrationTable, Direction::Bidirectional] then
LatestModifiedOn[2] := PerformScheduledSynchToIntegrationTable(Rec);
if Direction in [Direction::FromIntegrationTable, Direction::Bidirectional] then
LatestModifiedOn[1] :=
PerformScheduledSynchFromIntegrationTable(Rec, CRMConnectionSetup.GetIntegrationUserID);
UpdateTableMappingModifiedOn(Rec, LatestModifiedOn);

And the current UpdateTableMappingModifiedOn looks like:

with IntegrationTableMapping do begin
if ModifiedOn[1] > "Synch. Modified On Filter" then
"Synch. Modified On Filter" := ModifiedOn[1];
if ModifiedOn[2] > "Synch. Int. Tbl. Mod. On Fltr." then
"Synch. Int. Tbl. Mod. On Fltr." := ModifiedOn[2];
Modify(true);

And the current SetIntRecordRefFilter
TableFilter := GetIntegrationTableFilter;
if TableFilter <> '' then
IntRecordRef.SetView(TableFilter);

if "Synch. Int. Tbl. Mod. On Fltr." <> 0DT then begin
ModifiedOnFieldRef := IntRecordRef.Field("Int. Tbl. Modified On Fld. No.");
ModifiedOnFieldRef.SetFilter('>%1', "Synch. Int. Tbl. Mod. On Fltr.");
end;

Lets set an example when having 20k customer in the database (Is a lot, but for the sake of argument).
When the job que starts, it will run this line LatestModifiedOn[1] := PerformScheduledSynchFromIntegrationTable(Rec, CRMConnectionSetup.GetIntegrationUserID);
In function PerformScheduledSynchFromIntegrationTable this filter will be set:

if "Synch. Int. Tbl. Mod. On Fltr." <> 0DT then begin
ModifiedOnFieldRef := IntRecordRef.Field("Int. Tbl. Modified On Fld. No.");
ModifiedOnFieldRef.SetFilter('>%1', "Synch. Int. Tbl. Mod. On Fltr.");
end;

When PerformScheduledSynchFromIntegrationTable returns, UpdateTableMappingModifiedOn will be called, and this line will run:
if ModifiedOn[1] > "Synch. Modified On Filter" then
"Synch. Modified On Filter" := ModifiedOn[1];

This means that "Synch. Int. Tbl. Mod. On Fltr." will remain emtpy, and the next time synchronization is running, it will try to find every record that has been change after
"Int. Tbl. Modified On Fld. No.", but this field is empty.
This will result in getting all the 20k customer in the filter, even if they were not modified.

My suggestion is to change this:

if Direction in [Direction::ToIntegrationTable, Direction::Bidirectional] then
LatestModifiedOn[2] := PerformScheduledSynchToIntegrationTable(Rec);
if Direction in [Direction::FromIntegrationTable, Direction::Bidirectional] then
LatestModifiedOn[1] :=
PerformScheduledSynchFromIntegrationTable(Rec, CRMConnectionSetup.GetIntegrationUserID);
UpdateTableMappingModifiedOn(Rec, LatestModifiedOn);

To:

if Direction in [Direction::ToIntegrationTable, Direction::Bidirectional] then
LatestModifiedOn[1] := PerformScheduledSynchToIntegrationTable(Rec);
if Direction in [Direction::FromIntegrationTable, Direction::Bidirectional] then
LatestModifiedOn[2] :=
PerformScheduledSynchFromIntegrationTable(Rec, CRMConnectionSetup.GetIntegrationUserID);
UpdateTableMappingModifiedOn(Rec, LatestModifiedOn);

Like it was in Dynamics NAV 2018.

Thank you.

Category: Data Migrations
STATUS DETAILS
Completed
Ideas Administrator

Thank you for your feedback. We released as part of Release Wave 1 2020 (version >=17 have this fixed).

Instead of switching LastModifiedOn[1] and [2], we changed SetIntRecordRefFilter and we now filter on "Synch. Modified On Filter" instead of "Synch. Int. Tbl. Mod. On Fltr.".
For future reference, please use standard support channels (link below) to submit product issues as this ensures much quicker fix that is potentially downgraded to versions you report it in.

Sincerely,
Business Central Team

Comments

D

This is really just a bug/mistake in the code. Just switch the 1 and the 2 like Daniel suggested. Daniel's explanation is far too long--but his solution is correct.

Here's a simpler explanation:
In the OnRun trigger of C5340 the LatestModifiedOn array is set so that the first value shows the latest modified date from CRM, and the 2nd shows the latest modified date from NAV. But they are used to update the opposite fields in the function: UpdateTableMappingModifiedOn.
The 1 & 2 position markers just need to be switched in the OnRun trigger.

Category: Data Migrations

D

I mean how did this went unnoticed till now, I'm starting to doubt that people are actually using the built-in integration between Business Central and Dynamics 365.

Category: Data Migrations

D

what do you mean it is not currently on your roadmap !!!! It is a CLEAR BUG!!
When the Integration Map is reading from the CRM, then the "Synch. Int. Tbl. Mod. On Fltr." should be filled instead of "Synch. Modified On Filter" field, otherwise each time the Integration runs it will re-read all the record that were not even modified.

Category: Data Migrations