I'm attempting to synch custom fields in Business Central with custom fields in the Dataverse used by D365 for Sales. I'm able to create the custom fields using AL code in BC and customizations in D365. I'm also able to create new Integration Field Mapping records in the Integration Table Mapping area for Customers.
I followed these articles to get me this far:
Customizing an Integration with Microsoft Dataverse - Business Central | Microsoft Docs
Below is a code snippet of 2 fields I want to create an integration field mapping record for:
InsertIntegrationFieldMapping(
IntegrationTableMappingName,
Customer.FieldNo("Chapter"),
CDSAccount.FieldNo("new_chapter"),
IntegrationFieldMapping.Direction::FromIntegrationTable, '', true, false);
InsertIntegrationFieldMapping(
IntegrationTableMappingName,
Customer.FieldNo("Category"),
CDSAccount.FieldNo("AccountCategoryCode"),
IntegrationFieldMapping.Direction::FromIntegrationTable, '', true, false);
The procedure called by these 2 field mappings is this –
procedure InsertIntegrationFieldMapping(IntegrationTableMappingName: Code[20]; TableFieldNo: Integer; IntegrationTableFieldNo: Integer; SynchDirection: Option; ConstValue: Text; ValidateField: Boolean; ValidateIntegrationTableField: Boolean)
var
IntegrationFieldMapping: Record "Integration Field Mapping";
begin
IntegrationFieldMapping.CreateRecord(IntegrationTableMappingName, TableFieldNo, IntegrationTableFieldNo, SynchDirection,
ConstValue, ValidateField, ValidateIntegrationTableField);
end;
Both of the field mappings get created in the integration mapping table but a problem occurs with the “Chapter” field.
If I just create “Category” mapping a custom BC field (Category) with an out-of-the-box D365 field (AccountCategoryCode), I am able to couple a Customer/Account pair and sync data.
If I also create the “Chapter” mapping a custom BC field (Chapter) with a custom D365 field (new_chapter), I am NOT able to couple Customer/Account records and sync.
I am including some snapshots of what the mapping table looks like with just Category created and with both Category and Chapter created and an error message that is displayed when attempting to couple. One thing I noticed is that the Integration Field Name is blank for Chapter but does show an Integration Table Field No. of 10019 which was generated with the AL Table Proxy Generator tool. Below is the entry in the generated file.
field(10019;new_Chapter;Text[20])
{
ExternalName = 'new_chapter';
ExternalType = 'String';
Description = 'This is a chapter field';
Caption = 'Chapter';
}
It appears the custom D365 (DataVerse) field does not exist or cannot be resolved but the generator tool clearly sees the field and added to the file so that I could reference it in code. I also see the custom field (new_chapter) in their D365 instance. The D365 database is the same as the DataVerse correct? I’m not sure where the disconnect may be but any help is appreciated.
This worked for me. I needed to set /tabletype:CRM when running altpgen.exe.
@Erik Hougaard explains it well in this video: www.youtube.com/watch
I think this may be the step I'm missing. How do you generate an updated definition of the "Dataverse Account" table in BC?
Did you generate an updated definition of the "Dataverse Account" table in BC? This "integration table" or "proxy table" must have the same definition as the table in Dataverse in order for AL code to interact with the actual dataverse table.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156