Category Archives: Data Management

Data Management

D365 FO: Data Entity “onMappingEntityToDataSource” event

Requirement

In Microsoft Dynamics 365 finance and operations, client has an data entity for importing list of customer account into a table.During the time of importing of customer accounts using Data entity, client also want to capture & save values of few fields.

Continue reading D365 FO: Data Entity “onMappingEntityToDataSource” event

D365 FO & PowerAPPS – Lookup From Data entities

Requirement – Connecting Microsoft Power Apps to Data Entity of Microsoft Dynamics 365 for finance and operations. Then create a lookup from Data entity.

Continue reading D365 FO & PowerAPPS – Lookup From Data entities

Execute Actions in ODATA Entities & CALLING IN MICROSOFT Flow/Power Automate/Logic Apps

Requirement –

  1. Developing & adding actions on OData entities of Microsoft Dynamics 365 finance and operations
  2. Consuming and calling Data entity action in Microsoft Flow or Logic Apps Or Microsoft Power Automate

Development-

  • Create or develop a custom data entity. Read More:
  • Add a new method in your custom data entity by using Attribute -SysODataActionAttribute & SysODataCollectionAttribute
[SysODataActionAttribute("demoExecuteActionListParm", true),
        SysODataCollectionAttribute("InventSiteIdList", Types::String),
     SysODataCollectionAttribute("return", Types::String)]
    public str demoExecuteActionListParm(List InventSiteIdList)
    {
				str	siteCommaSeperated;
				List list = new List(Types::String);
				ListEnumerator  ListEnumerator;
				ListEnumerator = InventSiteIdList.getEnumerator();
				while (ListEnumerator.moveNext())
				{
          siteCommaSeperated += strFmt('%1, ', ListEnumerator.current()) ;
				}

				return '200 OK:Testing Of Odata Entity ExecuteAction has been completed!! Values = ' + siteCommaSeperated;
    }
  • Build and synchronize your project
  • Test your flow and get response successfully.

D365 FO/AX7: Composite Data Entities Vs Data Entities With Example

  • Introduction – Data management framework of Microsoft Dynamics 365 finance and operations contains a very important technical asset called Data Entities. Data entities are conceptual combinations, abstraction and encapsulation of one of more underlying tables. Data entities in Microsoft D365 finance and operations are used to import and export data in Microsoft Dynamics finance and operations. Odata integration can also be achieved using D365 finance and operations data entities. We can customize standard data entity . Click Here to know about standard data entity customization.
  • Composite Data entity vs Simple Data Entity- There are some differences between Composite Data entity & Simple Data Entity. 1 ) First of all simple data entity contains one or more tables where as composite data entity contains multiple data entities 2) Simple Data entities support Odata & can be used in Odata integration whereas Composite data entities cannot be used Odata integration.
  • Where should we use Composite Data entity ?-Composite entity is used in scenarios where an entity can be represented as a single document, like Purchase Header/line , Sales header/line, Invoice header/line etc.
  • Example & Development of Composite Data entity steps are mentioned below :
  • In example i am taking 2 separate standard data entities i.e. PurchPurchaseOrderHeaderV2Entity & PurchPurchaseOrderLineV2Entity
  • PurchPurchaseOrderHeaderV2Entity contains purchase order header information & fields mainly purchTable Fields
  • PurchPurchaseOrderLineV2Entity contains purchase order Lines information & fields mainly PurchLine Fields
  • We will develop a new composite data entity by using above 2 data entities and compose data entity will represent a single purchase order document (Purchase Order Header + Purchase Order Line)
  • Now create a composite data entity in your project.
  • Extend PurchPurchaseOrderLineV2Entity and create relation with PurchPurchaseOrderHeaderV2Entity. (NOTE In my case standard relation is already there so no need to create any customize relation)
  • Right click on your composite data entity and add “New Root Data Entity Reference” and make sure property Data Entity should be equal to PurchPurchaseOrderHeaderV2Entity
  • Right click on your “New Root Data Entity Reference” PurchPurchaseOrderHeaderV2Entity and add “New Embedded Data Entity Reference” equals to PurchPurchaseOrderLineV2Entity & Property Relation should be equal to PurchaseOrderHeader.
  • Extend staging table (PurchPurchaseOrderLineV2Staging) of data entity PurchPurchaseOrderLineV2Entity and add relation with the staging table (PurchPurchaseOrderHeaderV2Staging) of data entity PurchPurchaseOrderHeaderV2Entity.(NOTE : In my case standard relation already exist so i am not creating any relation)
  • Add two columns, RowId and ParentRowId (type int), on all the staging tables i.e. PurchPurchaseOrderHeaderV2Staging & PurchPurchaseOrderLineV2Staging.
  • Create a cluster index on the staging tables which includes RowId, ParentRowid,DefinitionGroup, and ExecutionId for getting good performance .
  • Build and synchronize your project
  • Under “Data import/export framework parameters”, select fast tab “Entity Settings” and click on “Refresh Entity List”. Here is LINK AND TUTORIAL.

D365 FO/AX7: The natural key for the table XXXX was not found [Solved] Data Entity Error

  • Issue – During the creation of data entity of table VendInvoiceTrans in Microsoft Dynamics 365 Finance and operation, system is throwing error- The natural key for the table VendInvoiceTrans was not found.
  • Root Cause The reason is that the table VendInvoiceTrans is using  RecId as its primary index. D365 Fo Data Entity Wizard doesn’t support tables with a RecId as a primary index.
  • Steps to Solve
  • Duplicate any existing data entity in your D365 fins and ops project and model. In my case i am making a duplicate copy of existing data entity – EMPSurveyTableEntity
  • Rename the duplicate copy of data entity
  • Change the existing datasource of data entity from EMPSurveyTable to VendInvoiceTrans
  • Delete existing fields of data entity and add new field from datasource vendInvoiceTrans
  • Remove the field from KEYS –> ENTITY KEY and new fields as per your need from datasource VendInvoiceTrans. ENTITY KEY fields should not allow duplicate and should be unique combination.
  • Change the Data entity properties PUBLIC COLLECTION NAME , PUBLIC ENTITY NAME & DATA MANAGEMENT STAGING TABLE to new values.
  • Right click on data entity and regenerate Staging Table Again
  • Assign data entity to security privilege.
  • Rebuild and synchronize the project .

D365 FO & MS Forms Pro Survey Integration : Send & Save Survey Responses using Microsoft Power Automate/Microsoft Flow/Azure Logic Apps

  • Objective – Microsoft Dynamics 365 (Finance & operations) & Forms Pro Survey Integration : Send and Save Survey Responses using Microsoft Power Automate/Microsoft Flow/Azure Logic Apps.
  • Scenario – Organisation wants to send Employee Satisfaction Survey to their employees via email. Employee will complete the survey . Survey Responses should be store and save in Microsoft Dynamics 365 Finance & operations.
  • Technologies/Products – Microsoft Form Pro(Free 30 Days Trial), Microsoft Dynamics 365 Finance & operations, Microsoft Power Automate(Microsoft Flow/Azure Logic Apps).
  • Prerequisite – Before moving ahead individual must go and see my old post on Microsoft Forms i.e. Microsoft Forms : Create a Survey Form From Scratch. Individual should have knowledge of Microsoft Power Automate(Microsoft Flow/Azure Logic Apps) & Dynamics 365 Finance & operations development.
  • Send Survey – Login to Microsoft Power Automate/Microsoft Flow/Azure Logic Apps. Create a Microsoft Flow for sending Employee Surveys to the employees of the company . In this scenario i am using a custom data entity of Employee master which is returning fields – Employee Code & Employee Email, Employee. You can use your own data entity as per your requirement and business need. I am reading all the Employee records and sending surveys in their email. You can add more conditions as per your business need. For demonstration purpose i am keeping things simple.Please refer below flow for your reference.
  • Storing and saving Survey responses – Create a Microsoft Flow for Storing and saving Survey responses in Microsoft Dynamics 365 Finance and operations using D365 FO custom data entity and Microsoft Flow Fins and ops connectors.Please refer below flow for your reference.

Cheers, piyush adhikari +91-7995802472 & piyushadh@gmail.com

D365/AX7: X++ Code To Create Item or Released Product Using Data Entity EcoResReleasedProductCreationV2Entity

Requirement

X++ Code To Create Item or Released Production Using Data Entity EcoResReleasedProductCreationV2Entity

Sample Code

class CreateReleasedProduct
{ 
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{ 
EcoResReleasedProductCreationV2Entity ecoResReleasedProductCreationV2Entity;
;

ecoResReleasedProductCreationV2Entity.clear();
ecoResReleasedProductCreationV2Entity.initValue();
ecoResReleasedProductCreationV2Entity.ItemNumber = '1104X';
ecoResReleasedProductCreationV2Entity.ItemModelGroupId = 'Stocked';
ecoResReleasedProductCreationV2Entity.InventoryUnitSymbol = 'ea';
ecoResReleasedProductCreationV2Entity.BOMUnitSymbol = 'ea';
ecoResReleasedProductCreationV2Entity.ProductGroupId = 'FG';
ecoResReleasedProductCreationV2Entity.ProductType = EcoResProductType::Item;
ecoResReleasedProductCreationV2Entity.ProductNumber = '1104X';
ecoResReleasedProductCreationV2Entity.ProductSearchName = '1104X';
ecoResReleasedProductCreationV2Entity.ProductName = '1104X';
ecoResReleasedProductCreationV2Entity.TrackingDimensionGroupName = 'None';
ecoResReleasedProductCreationV2Entity.ProductSubType = EcoResProductSubtype::Product;
ecoResReleasedProductCreationV2Entity.SearchName = '1104X';
ecoResReleasedProductCreationV2Entity.SalesUnitSymbol = 'ea';
ecoResReleasedProductCreationV2Entity.StorageDimensionGroupName = 'SiteWH';
ecoResReleasedProductCreationV2Entity.PurchaseUnitSymbol = 'ea';
ecoResReleasedProductCreationV2Entity.insert();

}

}

D365/AX7:Get Parameters (DataEntityRuntimeContext/DataEntityRuntimeContext) in Data Entity Events

[DataEventHandler(tableStr(AcxBrandEntity), DataEventType::MappingEntityToDataSource)]
public static void AcxBrandEntity_onMappingEntityToDataSource(Common _sender, DataEventArgs _eventArgs)
{
DataEntityContextEventArgs dataEntityContextEventArgs = _eventArgs;
DataEntityRuntimeContext runtimeContext = dataEntityContextEventArgs.parmEntityContext();
DataEntityDataSourceRuntimeContext DataEntityDataSourceRuntimeContext = dataEntityContextEventArgs.parmEntityDataSourceContext();

}

Get Parameters (DataEntityRuntimeContext/DataEntityRuntimeContext) in Data Entity Events