在最近的一个实施项目中,我们使用了F&SCM(F&O)通过CD的客户集成功能,作为公共数据服务(CD)功能的功能。数据集成项目或数据集成商(用于管理员)是一个框架(作为通用数据服务数据集成的一部分),用于促进Dynamics 365在金融和运营中的数据集成(FIN&SCM,也称为F&O)和销售动力学365。
通过电源查询或基于M的查询,也可以有其他数据来源连接到数据集成。在这种情况下,我们正在与Finops中的客户绘制销售中的帐户。
设置数据集成项目:
设置数据集成项目的先决条件是首先设置连接集。连接集是可以连接到各种数据源的框架。例如,在下面的连接集中,我们设置了一个连接集,该连接集将有助于在Dynamics 365中的帐户之间集成销售和财务和运营客户的客户之间的数据。确保连接设置指向正确的法律实体。图1 - 连接集
设置连接集后,设置数据集成项目并确保正确设置映射。另外,一旦准确设置数据集成,就确保正确的字段映射设置。
设想:
该方案是将销售中的帐户映射到Finops中的客户。除此之外,这些帐户在销售中的地址和联系方式与主地址或FINOPS中的主要联系人类型一起映射。另一个要求是具有在Finops中创建非主要地址和非主要联系人的能力。数据集成项目利用Finops的数据管理功能来管理数据集成。这也意味着来自数据管理框架的各种数据实体是在Finops中触发的。在这种情况下,对于客户而言,触发的数据集成实体是Custcustomerv3ent。
笔记:CD中用于客户的集成实体是Custcustomerv2ent。一个需要删除Custcustomerv2ent在下面数据管理 - >数据实体。数据实体Custcustomerv2ent需要先删除并明确添加Custcustomerv3ent(如平台更新31)。
LogissicsPostalAddress代码:
在创建地址后,覆盖事后处理程序以编辑非主要地址。如果是LogississPostalAddress,则是X ++代码,用于编辑网格控件中的详细信息。
[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; FormDataObject IsPrimaryDet; LogisticsPostalAddress logisticsPostalAddress; DirPartyLocationRole dirPartyLocationRole; LogisticsLocation logisticsLocation; DirPartyLocation dirPartyLocation; CustTable custTable; 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; if(dirPartyLocation) { //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 if(!dirPartyLocation.IsPrimary) { //Edit the Postal Address details like City, State, Zip Code logisticsPostalAddress_ds.allowEdit(true); //Edit the name or description details in the Address logisticsLocation_ds.allowEdit(true); //Enable the purpose group sender.control(sender.controlId(formControlStr(LogisticsPostalAddress,PurposeGroup))).enabled(true); //IsPrimary toggle control disabled for non-Primary addresses sender.control(sender.controlId(formControlStr(LogisticsPostalAddress,IsPrimary))).enabled(false); } } } }
LogisticsElectronicAddress代码:
[FormDataSourceEventHandler(formDataSourceStr(LogisticsContactInfoGrid, LogisticsElectronicAddress), FormDataSourceEventType::SelectionChanged)] public static void LogisticsElectronicAddress_OnSelectionChanged(FormDataSource sender, FormDataSourceEventArgs e) { LogisticsElectronicAddress LogisticsElectronicAddress; LogisticsLocation logisticsLocation; DirPartyLocation dirPartyLocation; CustTable custTable; FormRun element; 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; if (dirPartyLocation) { 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 typeObject.allowEdit(!LogisticsElectronicAddress.IsPrimary); LocatorObject.allowEdit(!LogisticsElectronicAddress.IsPrimary); LocatorExtensionObject.allowEdit(!LogisticsElectronicAddress.IsPrimary); DescriptionObject.allowEdit(!LogisticsElectronicAddress.IsPrimary); CountryRegionCodeObject.allowEdit(!LogisticsElectronicAddress.IsPrimary); //IsPrimaryObject.allowEdit(!LogisticsElectronicAddress.IsPrimary); // if contact information is primary // disable the advanced button so users cannot edit details in that screen advancedButton.enabled(!LogisticsElectronicAddress.IsPrimary); // disable the delete button deleteContactInfoButton.enabled(!LogisticsElectronicAddress.IsPrimary); } } }
配置密钥:
LEDGERBASIC是启用CustCustomerv3entity所需的配置密钥。这将在Dynamics 365中启用(默认情况下)用于金融和运营。
github链接:
代码存储库已上传到GitHub上,以下是Visual Studio项目的链接。
笔记:
该项目位于VAR层上。
https://github.com/nav21n/d365finops/tree/master/samples/cdsintegration
模型文件也已上传到GitHub上。导入模型并构建模型和项目。模型文件名是:d365dmosamples。使用命令行导入模型文件。
模型文件名:D365DMOSPAMES
命令导入模型文件。在构建模型和项目之前,必须执行以下步骤。在这种情况下,我选择了C:model_backups作为模型文件的源目录。
图2 - 导入模型文件