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:

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:

Execute Dynamics 365 OData actions as CDS actions using Virtual Entities 2
OData Action in Flow

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:

Execute Dynamics 365 OData actions as CDS actions using Virtual Entities 3
OData action and Virtual Entity action

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:

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!

An example

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:

Execute Dynamics 365 OData actions as CDS actions using Virtual Entities 4
Open 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:

Execute Dynamics 365 OData actions as CDS actions using Virtual Entities 5
FnO sales orders on a Power App 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:

Execute Dynamics 365 OData actions as CDS actions using Virtual Entities 6
CDS action from FnO

I select the sales order and post it using the button from the Power App:

Execute Dynamics 365 OData actions as CDS actions using Virtual Entities 7
Power App posting sales order

We need to wait until the Flow ends…

Execute Dynamics 365 OData actions as CDS actions using Virtual Entities 8

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!

Execute Dynamics 365 OData actions as CDS actions using Virtual Entities 9
Posted sales order from the Virtual Entity

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!

Subscribe!

Receive an email when a new post is published

Write A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Do NOT follow this link or you will be banned from the site!