web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

How to implement strong Contact integration between BC and Dataverse

(5) ShareShare
ReportReport
Posted on by 14
Hi,
my scenario:
D365 BC 20 On-Premise
Dataverse/Dynamics 365 Sales Online
D365 BC is integrated with Dataverse using data-sync hybrid Dataverse Connection Setup. (Standard native data-sync connector)
In BC23.5 and previous versions, we cannot add new integration tables other than the default tables. We need to go through complex AL customizations.
 
 
I am trying to create this custom scenario:
  1. I want to create standalone code and prevent the automatic creation of Microsoft default records in the 'Integration Table Mapping' (5335) table. My goal is to have only my custom records appear when clicking 'Use Default Synchronization Setup';
  2. Contacts created in Business Central must be imported into Dataverse and can only be updated from Business Central;
  3. Contacts created in Dataverse must be imported into Business Central and can only be updated from Dataverse.
 
The guidelines posted in the official microsoft documentation (Customizing an integration with Microsoft Dataverse) do not help me achieve these objectives.
However, I'm not sure if it's enough to use one-direction way (from/to integration) or two way direction (bidirectional)...
 
Could someone suugest me any compatible integration logic, please?
Could someone provide me any AL code sample, please?
Could someone help me, please?
 
Thanks!
I have the same question (0)
  • Suggested answer
    Holly Huffman Profile Picture
    6,538 Super User 2025 Season 2 on at
    Good morning, afternoon, or evening depending on your location :)
    Hope you are well today!
     
    Based on the latest Microsoft documentation and your scenario (BC 20 On-Premise with hybrid Dataverse sync), here’s a tailored approach to implement custom Contact integration between Business Central (BC) and Dataverse, while avoiding default mappings and enforcing one-way sync rules:
     
    Your Goals Recap
    1. Custom integration only – no default mappings in table 5335 (Integration Table Mapping).
    2. One-way sync:
      • BC → Dataverse: Contacts created in BC sync to Dataverse, only updated in BC.
      • Dataverse → BC: Contacts created in Dataverse sync to BC, only updated in Dataverse.
     
    Recommended Integration Logic
    1. Prevent Default Mappings
    To avoid default records in Integration Table Mapping when using "Use Default Synchronization Setup":
    • Override the event OnAddEntityTableMapping in codeunit CRM Setup Defaults (5334).
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"CRM Setup Defaults", 'OnAddEntityTableMapping', '', false, false)]
    local procedure SkipDefaultMappings(var IntegrationTableMapping: Record "Integration Table Mapping"; var Handled: Boolean)
    begin
        Handled := true; // Prevents default mappings from being added
    end;

    2. Create Custom Integration Table for Contact
    Use the AL Table Proxy Generator (altpgen.exe) to generate a proxy table for the Dataverse Contact entity.
    altpgen.exe -project:"<YourProjectPath>" -packagecachepath:"<YourCachePath>" -serviceuri:"<DataverseURL>" -clientid:"<ClientID>" -redirecturi:"<RedirectURI>" -entities:contact -baseid:50000
     
    This generates a table like:
    table 50000 "Dataverse Contact"
    {
        TableType = CDS;
        // Fields from Dataverse Contact entity
    }

    3. Create Custom Integration Table Mapping
    Manually insert your custom mapping into Integration Table Mapping (5335) via AL or setup codeunit:
    IntegrationTableMapping.Init();
    IntegrationTableMapping."Table ID" := DATABASE::Contact;
    IntegrationTableMapping."Integration Table ID" := DATABASE::"Dataverse Contact";
    IntegrationTableMapping.Direction := IntegrationDirection::ToIntegration; // or FromIntegration
    IntegrationTableMapping.Insert();

     
    Use ToIntegration for BC → Dataverse and FromIntegration for Dataverse → BC.
     
    4. Control Sync Direction
    Use the Direction field in Integration Table Mapping:
    • BC → Dataverse: ToIntegration
    • Dataverse → BC: FromIntegration
    This ensures updates only flow in one direction.
     
    5. Coupling Logic
    Use CRM Integration Management codeunit to manage coupling manually. You can create a page to allow users to couple records explicitly.
     
    6. Field Mapping
    Use Integration Field Mapping table to define which fields sync. You can also use transformation rules here to handle formatting or value differences.
     
    Testing Tips
    • Use a sandbox environment.
    • Test sync in both directions with filters applied.
    • Monitor Integration Sync Job and Integration Sync Error tables for issues.
     
    References  
    Note: I collaborated with Copilot to help craft this response for clarity and completeness.
    Hope this helps some!
  • Suggested answer
    YUN ZHU Profile Picture
    95,729 Super User 2025 Season 2 on at
    Hi, hope the following can give you some hints.
    Dynamics 365 Business Central Blog Series: Integrate with Microsoft Dataverse
     
    Thanks.
    ZHU
  • Suggested answer
    Tech-Lucky Profile Picture
    1,267 Super User 2025 Season 2 on at

    To achieve this, you must implement custom actions for synchronization and completely avoid using standard actions or code paths. Overriding the default synchronization logic is not straightforward, as the system triggers built-in events tied to the Dataverse Connection Setup and Integration Table Mapping for standard tables. These system events are automatically invoked, making it difficult to bypass them selectively.

    A more reliable approach is to create custom integration tables and manage synchronization through your own code. By populating these custom tables and handling the sync logic manually, you can fully bypass the standard event triggers and gain complete control over the data flow between Business Central and Dataverse.

  • Suggested answer
    Jainam M. Kothari Profile Picture
    15,639 Super User 2025 Season 2 on at

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,238

#2
YUN ZHU Profile Picture

YUN ZHU 773 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 630

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans