One Dynamics One Platform - Dataverse C# Plugin for Dynamics 365 F&O
Hello the Community, back from the D365 FO Summit 2023 in Lisboa, after 3 years it was really good to meet in-person again after Covid ! Thanks all that were here with smiles, coming from all over the planet and hope you have learned a lot of things shared by the community. I have selected some great photos :)
On my side, I have done a half-day workshop Friday on Power Platform with F&O and also Saturday a new session on Dynamics 365 e-Commerce in B2B !
Previous post on my famous topic (always trying to push more Dynamics 365 ERP Implementation with Power Platform) I made an article on CDS Virtual Entities for D365 F&O. Almost 3 years after a lot of things have changed… So I will take this opportunity here to update few points here - and Time flies…
A few days back, I had the chance to explain during a workshop about something new, in this article, we will deep dive more into it (since for me it’s a good opportunity to start writing C# Plugin even if you are a very good X++ Developer :)
This topic is again also part of the One Dynamics One Platform. As a starting point and introduction, I’ll highly recommend watching before reading my article! PG team of Microsoft explains a lot of high important topics of the future/vision. Some of those features are already there - including what I’ll show you here.
-
One Admin : PPAC, PP CLI
-
One Dev (Local, ALM )
-
One UI/UX
-
One Insight (Synapse Link Dataverse)
So now, how to start ? Well first, I need to explain a little more the 1 to 1 link between your Dataverse and Finance Operations. Again a lot of things have changed and thanks Microsoft to help us doing this link more easier as of it was done in July 2020 with a lot of technical setup. Now, it’s really straight forward.
When you create your FinOps TIER2 or Prod instance, they will ask you if you like to create your Dataverse and automatically link it. It’s 1 OPTION, but you can also say “No way - I’ll do it my own”. On my side, I am more on this 2nd option - especially if you have already your CE / Dataverse already deployed - or would like to set up your Dataverse with the setup you like (Default Currency, Default Base Language etc…)
Either way, even if you don’t select PP integration, Microsoft will create a basic default one. This one can be deleted only if you link to the right one after.
One last point important, pick the right PP template here. If you don’t need Dual Write, don’t pick this one. This will change all important CE forms, schema, model to include a lot of things including as an example the famous Company field (Legal entity)
OPTION 1 below : (simple and fast, but you can’t pick all the default important setup of your Dataverse like explained before)
OPTION 2 Below : (didn’t chosen the PP integration as part of creating my TIER2 instance)
As you can see below, even if I didn’t pick PP integration, a default initial PP/Dataverse environment has been created.
Indeed, like below, you can see a default one has been created for me, even if I said “No way”
But, that’s not a big deal, I’ll now create a new Dataverse with my default configuration I would like (that’s why I prefer this option)
Here, I can choose the language, curreny, URL etc… and also maybe enable Dynamics 365 CE Apps if I wanted too. (like Sales, Marketing etc…) or even default security group
So now, I have 2 DV environments, not great but it’s only temporary
Now, grab the environment ID of the 2nd option (the one you have created manually)
Go to LCS, and click on the Setup button on PP integration and put the Environment Id
After that, you can now delete the initial one since this DV is now unlinked and linked to the new one you have created manually.
You can also see behind the scene some solutions have been installed and configured for you, including the famous one needed for Virtual Table of F&O. (in the Dynamics 365 apps part)
Good point now, you’ll be able to activate Data entity of F&O as part of a Virtual Table into your Dataverse. No technical setup is needed now in 2023 !
So for that, you have again 2 options. 1 not very sexy process, 1 likely straight forward which I use a lot.
OPTION 1 below : On the right Dataverse linked F&O environment, click on Settings Button / Advanced Settings
And after clicking on the Advanced Find Button, search for Available the Finance Operations Virtual Entities
You can filter since you’ll have like 3k Data Entities. This is for me the most important part, find & select the right one! To finish, click on the Results button
Select the Data Entity of F&O, click on the boolean “Visible” to YES. We will talk about the Refresh button after.
This process will trigger into the backend the creation of the Virtual Table into the Dataverse. Translating also Data types of F&O => CE
By the way, this will also create basic View and Form, that you can extend.
OPTION 2 below : By going on F&O side directly, into the Business Events Catalog / Data Events
I like this option, filter the right Data Entities (no matter Create, Update or Delete event) and Click Activate.
This will also launch behind the scene the creation of the Virtual Table like the option 1. The good thing, you stay on F&O side, and you can bypass the activation of the endpoint later on.
After that, you can find all Virtual Tables of ERP by searching for “mserp_XXXXXXXXXX” suffix.
You see the one we have activated before.
You can extend this Virtual Table, on Views on Forms which are really default ones ! (Just 1 field displayed…)
Again don’t forgot on DV DEV side, you should done this extension on part of a solution. (for ALM part that will talk at the end of this article)
Last point, which was a good question during the Lisbon F&O Summit. Of course, you could activate standard and custom DE of F&O. But also, if you deploy on a Sandbox or Prod, a new field, you should refresh the Virtual Table (so that the schema / metadata is well refreshed too on DV side)
But I have a good workaround to automate that since as you can see it’s not an automation process.
You could in fact build a quick Power Automate on-demand to save the refresh button that will launch the process behind the scene like this (Btw you could also do that to activate a new DE, just changing the Visible boolean instead) :
-
Parameter on-demand Flow
-
Retrieve the Entity
-
Update the Refresh boolean
-
New things in preview : change tracking of virtual table (Synapse Link Dataverse of F&O : part of the “One Analytics” explained in the introduction of this article)
Speaking of Cloud Flows Power Automate, since you have now the Virtual Table of F&O as part of Dataverse, you can now create anytime an automated flow with the DV connector like this :
Now you have activated some DE of F&O as Virtual Table into your DV. Let’s go deeper on DEV side.
So again, 1st important point into DV, let’s create a solution (like a model in F&O), you’ll store all your extensions like :
-
Model Driven App (MDA)
-
Canvas App
-
Views, Forms, Fields, new tables, relationships
-
Cloud Flows
-
And last but not least, plugin C# that was the main purpose of this article ;)
Remember here to put the right publisher, and create the solution on a DevBox F&O linked DV or at least Sandbox TIER2 F&O linked DV. (to respect your ALM process : DEV => QA => PROD). The type of Package will be unmanaged by default, and can be deliver as managed (same as F&O for .axmodel and deployable package of your model : compiled or source code available)
OK, now we are ready to go on DEV C# Plugin Dataverse based on a Virtual Table of F&O.
For that, you can (as of now) go to your F&O DevBox Azure VM. (CHE) - At some point, as explained by PG team of Microsoft, it will be possible to do that directly locally like any DV Developer. You can for this part also follow the Microsoft Doc :
I will open VS, not yet VS code ;)
Manage Extensions / search for PP Tools and install it.
A popup window will ask you to connect to the right Dataverse / Organization environment. You must select the PP Solution in which you want to store / deploy your C# DV Plugin.
After you can now select on the VS / View / PP Explorer
You can retrieve all your Virtual Tables of F&O with a search on “mserp_xxxxx” again
After right click on it, Register new Plugin. Again, like Data Events, you have CUD (Create, Update, Delete events). You’ll be asked here a lot of things, major parts are for Execution Mode and Event Pipeline Stage of Execution. Currently, only PostOperation is supported for Synchronous mode for Virtual Table.
Make sure, you are on .NET 4.6.2 . Also, create a private key to sign your project (mandatory for C# Plugin on DV)
You should be able to edit the code now in C# (yes yes not X++… :)
I made a quick one for you, just every time a S.O Header in F&O is created, I made a Plugin C# On DV to update another field on PostOperation. (Synchronous)
Again it’s just 1 example of code you can imagine here a lot of requirements that can be completed like this - especially for CE <=> F&O Integration in which you don’t want to rely on Dual Write for that. Keep in mind if you have activated DW on the same entity as VE, it’s not supported. So you have to make a choice here. But let’s say, you just want every time something happen on CE or F&O to update or create something else in another entity/table, it’s a very good pattern with this kind of VE/C# Dataverse Plugin. Since also, it’s more easier to find someone knowing this part than an X++ DEV ;)
If you want to learn more on C# Plugin Dataverse, I will encourage you to check this quick Video ; but you can also found a LOT of articles from my fellow MVP on CE side :
After building your solution, to Deploy your plugin like here :
As you can see, my plugin is now part of my solution in my TEST environment. So it’s already registered and can try it. A little fast as testing/deploying X++ right ? :)
I can also check that in F&O side like here :
OK, now I’m good, how to deploy in terms of ALM , DevOps ?
So first of all, as a good best practice for Dataverse side, even if you are more a “F&O” girl/boy - you should consider to install the CoE Starter kit. This solution (free) made by the Power Cat Team, is really a good way to have a clear view and help on the admin/analytics/governance part of PP. This also help you to install a good starting point on the ALM part. (ALM Accelerator)
You should consider that this solution can be integrated via Dev Ops (the same you use already for F&O) or even GitHub. Check this good article about it.
For DV side, it’s possible and supported to use GIT as a Repository.
Also a good presentation from Raphael about this point can be found here : (this time via GitHub)
You can in this case, say every time I deploy a new X++ Deployment Pipeline via DevOps for F&O, deploy also the Release pipeline for DV side. You can also deploy like if you are an AX 2012 DEV (.xpo) , manually ZIP files (unmanaged solution to managed solution from DV Environment A to DV Environment B)
posted on 2024-01-12 12:54 lingdanglfw 阅读(10) 评论(0) 编辑 收藏 举报