Since Dynamics 365 for Finance and Operations version 10.0.12 we’ve been able to use FnO (public) data entities as CDS Virtual Entities. This will allow us to create model-driven Power Apps for Finance and Operations entities without having to copy data between Finance and Operations and the Common Data Service (CDS). This opens a lot of scenarios and new ways of integrating MSDyn365FO with Customer Engagement.
If you want to learn more about setting up the Virtual Entities for FnO you can:
- Read the blog post about configuring Virtual Entities from Aurélien Clere where he describes all the steps and you’ll be able to find more information about CDS integrations with Finance and Operations.
Join this TechTalk: Virtual Entities for Finance and Operations Apps. 22 September at 4PM (GMT +2) or 22 September 11PM (GMT +2).
- Watch this tech talk about Virtual Entities for Finance and Operations.
CDS Virtual Entities
The CDS Virtual Entities represent data from other systems inside the Common Data Service and support all of the CRUD operations. In our case, the Virtual Entities are a representation of the public data entities in FnO.
When we set up the FnO Virtual Entities on CDS we need to enable the ones we want to use, and once enabled they’ll appear as a CDS entity.
The difference between using Virtual Entities or Dual-Write is that the Virtual Entities don’t duplicate data. Instead, there’s a real-time web API that queries data to and from FnO’s data entities.
FnO data entity action
Some FnO data entities have a special kind of methods that can be run in an OData call called OData actions. These methods need to be decorated with the SysOdataAction attribute and can be used in a Flow action:
FnO OData actions as CDS actions
CDS actions are operations that can also create or update (or delete) records, like the FnO actions. In the image below we see both connectors for a FnO OData action and a CDS action for the same entity:
As you can see we’re calling the AXZPostSalesOrder action from the AXZSalesOrderHeadersV2 entity. This entity is a duplicate of the standard sales order header entity where I’ve created the following method:
public static str postSalesorder(SalesId _salesId)
salesTable = SalesTable::find(_salesId);
salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
salesFormLetter.update(salesTable, systemDateGet(), SalesUpdate::All, AccountOrder::None, NoYes::No, NoYes::Yes);
This action will just post the invoice of an open sales order, something that can be useful to do from CE or a Power App while visiting a customer. And thanks to the virtual entities we can call it with the CDS connector!
In the following example, I’m going to show how a Dynamics 365 FnO sales order is posted using a CDS action from Flow. Let’s take this sales order:
You can see it’s open. I’ve created a simple canvas app with a DataTable that shows all of USMF’s company sales orders using the CDS virtual entity:
The app has a button that triggers a Flow which will get the record and call the action on the CDS Virtual Entity:
I select the sales order and post it using the button from the Power App:
We need to wait until the Flow ends…
And when it’s done (with an additional retry, that’s the reason behind the orange check) we can go back to Dynamics 365 and see the sales order has been posted!
With the Virtual Entities we get a new tool to not only access data from Finance and Operations into CDS but also execute business processes. We’re getting more and more tools to integrate the ERP and CRM products with less effort and better results!