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:
But it is simply ignored, and returns the eternally taunting:
Please, any advice on how to get around this silly block?
Cheers
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
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
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.
dynamicsuser.net/.../developers
I will open this up to the community in case they have something to add.
Sohail Ahmed
1,169
YUN ZHU
1,006
Super User 2025 Season 1
Mansi Soni
830