Thanks for your reply Oussama. I have code in place that utilizes the GUID to find the data I need, and that all works. My code runs as long as the CRM Account has been queued. If only that ParentAccountId on the Crm account has been changed, the record does not get queued.
You write "
The supported SaaS pattern is to insert the Integration Field Mapping record programmatically (for example from an Install or Upgrade codeunit), which bypasses the UI limitation entirely"
That is the part I am trying to do but cannot find the correct events to use or where to enter the code.
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Integration Rec. Synch. Invoke", 'OnAfterModifyRecord', '', false, false)]
local procedure "Integration Rec. Synch. Invoke_OnAfterModifyRecord"(IntegrationTableMapping: Record "Integration Table Mapping"; var SourceRecordRef: RecordRef; var DestinationRecordRef: RecordRef)
var
CRMAccount: Record "CRM Account";
Customer: Record Customer;
ParentCRM: Record "CRM Account";
begin
UpdateBillToCustomerNo(IntegrationTableMapping, SourceRecordRef, DestinationRecordRef);
end;
local procedure UpdateBillToCustomerNo(IntegrationTableMapping: Record "Integration Table Mapping"; var SourceRecordRef: RecordRef; var DestinationRecordRef: RecordRef)
var
CRMAccount: Record "CRM Account";
Customer: Record Customer;
ParentCRM: Record "CRM Account";
EmptyGuid: Guid;
begin
// Only handle CRM Account → Customer mapping
if GetSourceDestCode(SourceRecordRef, DestinationRecordRef) <> 'CRM Account-Customer' then
exit;
// Convert RecordRefs to actual records
SourceRecordRef.SetTable(CRMAccount);
DestinationRecordRef.SetTable(Customer);
if CrmAccount.ParentAccountId = EmptyGuid then begin
Customer."Bill-to Customer No." := '';
Customer.Modify(false);
DestinationRecordRef.GetTable(Customer);
exit;
end;
if (CRMAccount."AUK Group Statement") and not (CRMAccount."Auk Broker Head Office") then begin
if ParentCRM.Get(CRMAccount.ParentAccountId) then begin
if ParentCRM."AUK Agency Reference" <> Customer."Bill-to Customer No." then begin
Customer."Bill-to Customer No." := ParentCRM."AUK Agency Reference";
Customer.Modify(false);
// Push updated record back into the RecordRef
DestinationRecordRef.GetTable(Customer);
end;
end
end;