Skip to main content

Notifications

Community site session details

Community site session details

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

CDS integration, I cannot figure it out

(0) ShareShare
ReportReport
Posted on by 485

Greetings Everyone,

I have hit a brick wall and need your help please.

Context:

- using the CDS integration, I create contacts in BC coming from the CDS

- BC refuses to create contacts if they do not have a parentcustomerid in the cds (you can find it here: CRMIntTableSubscriber.Codeunit.al, line 499

- a big chunk of our contacts dont have, and wont have a parentcustomerid in the cds

I am trying to intercept the record in an event so that I can fill in a general parentcustomerid to make the system happy, but I cannot seem to catch it to do that, it is driving me nuts for hours.

I have tried :

- OnFindUnCoupledDestinationRecord

- OnBeforeTransferRecordFields

With something like:

   if (SourceRecordRef.Number() Database::"CRM Contact"then begin
            SourceRecordRef.SetTable(cdsrec);
            cdsrec.ParentCustomerId := 'MY-GUID';
        end;

But it is simply ignored, and returns the eternally taunting:

The contact cannot be created because the company does not exist.

Please, any advice on how to get around this silly block?

Cheers

  • Suggested answer
    pooya Profile Picture
    25 on at
    RE: CDS integration, I cannot figure it out

    it caused by wrong code in a procedure in codeunit CRMSyncHelper(maybe CDSSyncHelper in newer versions)

     local procedure FindCustomersContactByAccountId(var Contact: Record Contact; AccountId: Guid): Boolean
        var
            ContactBusinessRelation: Record "Contact Business Relation";
            CRMIntegrationRecord: Record "CRM Integration Record";
            Customer: Record Customer;
            CustomerRecordID: RecordID;
            OutOfMapFilter: Boolean;
        begin
            if IsNullGuid(AccountId) then
                exit(false); //IT SHOULD BE CHANGES TO TRUE

    as you can see it returns false when parent account is null, but you can simply change it to true.

    as you may know you can not edit base application codes by default but it is possible as you can see in bellow link

    Publishing a Code-Customized Base Application - Business Central | Microsoft Docs

  • Verified answer
    Hedi Daneels Profile Picture
    485 on at
    RE: CDS integration, I cannot figure it out

    For the archives, and maybe to help someone one day

    - I did not found a solution for this, so I took a different approach. I made a new integration and new mapping, from CRM contacts to BC customers, and used a bit of "onafterinsert" code to make some modifications.

    Cheers Everyone

  • Suggested answer
    Andy Sather Profile Picture
    on at
    RE: CDS integration, I cannot figure it out

    Hello  - We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    dynamicsuser.net/.../developers

    I will open this up to the community in case they have something to add.

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 1,169

#2
YUN ZHU Profile Picture

YUN ZHU 1,006 Super User 2025 Season 1

#3
Mansi Soni Profile Picture

Mansi Soni 830

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans