In one of the implementation projects recently, we used the F&SCM (F&O) customer integration through CDS capabilities, available as a feature in the Common Data Service (CDS). Data Integration projects or data integrator (for administrators) is a framework ( available as part of the Common Data Service data integration) that is used to facilitate the integration of data between Dynamics 365 for Finance and Operations (Fin&SCM, also known as F&O) and Dynamics 365 for Sales.
Through Power Query or M based queries, there can be other sources of data, too, that can be connected to for data integration. In this case, we are mapping accounts in Sales with customers in FinOps.
The prerequisite to setup Data Integration projects is to first set up the connection sets. Connection sets are the framework through which various sources of data can be connected to. For example, in the connection set below, we have set up a connection set that will facilitate integration of data between accounts in Dynamics 365 for Sales and customers in Finance and Operations. Ensure that the connection sets point to the right legal entities. Fig 1 – Connection Sets
After setting up the connection sets, set up the data integration projects and ensure that the mapping is set up properly. Also, ensure the field mapping setup properly once the data integration is set up accurately.
The scenario is to map accounts in Sales to customers in FinOps. In addition to this, the addresses and contact details of these accounts in Sales are mapped with the primary address or the primary contact type in FinOps. The other requirement is to have the ability to create non-primary addresses and non-primary contacts in FinOps. Data integration projects leverage the Data Management capabilities of FinOps to manage data integration. This also means that various data entities from the data management framework are triggered in FinOps. In this case for customers the data integration entity that is triggered is CustCustomerV3Entity.
Note:The integration entity in CDS that is used for Customers is CustCustomerV2Entity. One needs to delete the CustCustomerV2Entity under Data Management -> Data Entities. The Data Entity CustCustomerV2Entity needs to be deleted first and explicitly add CustCustomerV3Entity (as on Platform Update 31).
Override the post-event handler to edit non-primary addresses after the address is created. In case of LogisticsPostalAddress, following is the X++ Code to edit the details in the grid control.
[PostHandlerFor(formStr(LogisticsPostalAddress), formMethodStr(LogisticsPostalAddress, updateControls))]
public static void LogisticsPostalAddress_Post_updateControls(XppPrePostArgs args)
FormRun sender = args.getThis();
//Retrieve the two form data sources used in LogisticsPostalAddress form
FormDataSource logisticsPostalAddress_ds, logisticsLocation_ds;
logisticsPostalAddress_ds = sender.dataSource("LogisticsPostalAddress");
logisticsLocation_ds = sender.dataSource("LogisticsLocation");
//LogisticsPostalAddress and logisticsLocation details retrieved
logisticsPostalAddress = logisticsPostalAddress_ds.cursor();
logisticsLocation = logisticsLocation_ds.cursor();
//Retrieve the location details
select firstonly dirPartyLocation
where dirPartyLocation.Location == logisticsLocation.RecId;
//Retrieve the customer details from the address grid
custTable = CustTable::findByPartyRecId(dirPartyLocation.Party);
//Check if the customer record is externally maintained
if(custTable && custTable.IsExternallyMaintained)
//Validate if the address is non-primary
//Edit the Postal Address details like City, State, Zip Code
//Edit the name or description details in the Address
//Enable the purpose group
//IsPrimary toggle control disabled for non-Primary addresses
[FormDataSourceEventHandler(formDataSourceStr(LogisticsContactInfoGrid, LogisticsElectronicAddress), FormDataSourceEventType::SelectionChanged)]
public static void LogisticsElectronicAddress_OnSelectionChanged(FormDataSource sender, FormDataSourceEventArgs e)
FormControl advancedButton, deleteContactInfoButton;
// Retrieve the form buttons
element = sender.formRun();
advancedButton = element.design(0).controlName("DetailContactInfo");
deleteContactInfoButton = element.design(0).controlName("DeleteContactInfo") ;
// Retrieve the datasource fields objects
FormDataSource LogisticsElectronicAddress_ds = sender.formRun().dataSource("LogisticsElectronicAddress");
FormDataObject typeObject = LogisticsElectronicAddress_ds.object(fieldNum(LogisticsElectronicAddress, Type));
FormDataObject LocatorObject = LogisticsElectronicAddress_ds.object(fieldNum(LogisticsElectronicAddress, Locator));
FormDataObject LocatorExtensionObject = LogisticsElectronicAddress_ds.object(fieldNum(LogisticsElectronicAddress, LocatorExtension));
FormDataObject DescriptionObject = LogisticsElectronicAddress_ds.object(fieldNum(LogisticsElectronicAddress, Description));
FormDataObject CountryRegionCodeObject = LogisticsElectronicAddress_ds.object(fieldNum(LogisticsElectronicAddress, CountryRegionCode));
FormDataObject IsPrimaryObject = LogisticsElectronicAddress_ds.object(fieldNum(LogisticsElectronicAddress, IsPrimary));
// Retrieve customer record from the LogisticsElectronicAddress grid record
LogisticsElectronicAddress = LogisticsElectronicAddress_ds.cursor();
logisticsLocation = LogisticsLocation::find(LogisticsElectronicAddress.Location);
select firstonly dirPartyLocation where DirPartyLocation.Location == LogisticsLocation.RecId;
custTable = CustTable::findByPartyRecId(dirPartyLocation.Party);
// If the customer is externally maintained
if (CustTable && CustTable.IsExternallyMaintained)
// if contact information is not primary, make the fields in the grid editable
// if contact information is primary
// disable the advanced button so users cannot edit details in that screen
// disable the delete button
LedgerBasic is the configuration key that’s required for CustCustomerV3Entity to be enabled. This is enabled (by default) in Dynamics 365 for Finance and Operations.
The code repository is uploaded on github and following is the link to the Visual Studio Project.
The project resides on the var layer.
A model file is also uploaded on github. Import the model and build the model and the project. The model file name is: D365DMOSamples. Use the command line to import the model file.
Model File Name: D365DMOSamples
Command to Import the model file. This following step has to be executed before building the model and the project. In this case, i have chosen C:Model_Backups as my source directory for the model file.
Fig 2 – Import Model files
Comments are closed.