The Dynamics 365 Health Accelerator provides you a baseline set of entities, forms, views, relationships and even a model driven application. These components are designed to be used as the foundation for your application. There are many options for building applications on the Dynamics 365 Business Application Platform. Let’s review them and then go into more detail on how we would go about extending and building new applications based on the Dynamics 365 Health Accelerator. Each of these options represent opportunities leveraging the Dynamics 365 platform for Apps and Analytics. Future articles will showcase integrating with Office and Microsoft Teams. While this series is focused on the Health Accelerator, the overall details will work for any accelerator you have leveraging.
Each of these represents a unique opportunity to not only build new applications, but to leverage the Health Accelerator to connect, embed or extend your existing application, service or platform, whether it exists on Dynamics 365, Microsoft Azure or other 3rd party on-premise or online hosted solution. In this first blog post in the series we will review how to extend the Common Data Model for the Dynamics 365 Health Accelerator by leveraging Model Driven Power Apps for Customer Engagement.
Note: As this is not intended to be a comprehensive review of the Business Application Platform, If you are new to the platform and wish to learn more please review some of the links at the bottom of my previous article here.
To be able to follow this guide you will need at least a Trial instance of Dynamics 365. To setup a trial please go here. Select the type of trial you would like to use. In this case I would suggest a Sales trial. Dynamics will require that you have an Office 365 Tenant, so if you do not have one, my suggestion would be as follows.
Now that you have your Trial Customer Engagement Instance, in the same browser open a new tab and go to https://appsource.microsoft.com/en-US/ . In the search box type in Accelerator for Dynamics 365 and hit search. You will see the following application.
Click on Free Trial and fill in the information requested. As you go through the process you may be asked to select which Instance of Customer Engagement you want to install the application into. Make sure you select your Trial instance of Customer Engagement.
For the Health Accelerator the Common Data Model represents two combined sets of entities. First are the Microsoft Dynamics 365 Common Data Model entities, which represent the core entities provided with any Customer Engagement Application or CDS 2.0 database for Power Apps. For a review of the Common Data Model please look here. The Microsoft Dynamics 365 provides a GIT repo that enables you to download and provide feedback on the entities in the model, which can be found here. Second are the extensions specifically provided in the Health Accelerator solution. These extensions represent enhancements to existing entities, such as Contact and Account, as well as new entities such as Care Plans. The Health Accelerator entity model can be found in GIT here.
Extending the model means that you either want to create new entities, extend existing entities and / or create new relationships between new or exist entities to be able to perform the required functionality. Below are a few ways in which you can extend the Common Data Model. Remember that any changes you make to existing entities or when you add new entities exist only within your solution. They are visible to the entire system but are part of your private applications extensions. Let’s review some of the ways to extend the model.
Once you have installed the solution you should have a tab opened to your new trial instance of Dynamics Customer Engagement. If you closed it, please re-open it. Once you hit it open follow the next steps as we prepare to extend the model.
In the above picture you can see the actual accelerator solution. However, we do not want to change this solution directly. Our goal is to create a new solution that we can distribute to customers via AppSource, not modify the base accelerator solution. So now we need to create a new solution
In this first step we will be creating new entities. These new entities will help focus our model driven application.
So far, we have created a new entity and that entity will have at most the Primary Field attribute or “field”. But now we want to add more fields to the new entity to make it useful for our application.
Now that you have created new entities you have to decide on the types of relationships that you want to build. Model driven applications are highly driven by the relationships that exist between entities. Let’s look at a couple of examples. For a deeper look at creating relationships please visit our documentation here.
Let’s take a standard example, where I have just created my first custom entity, in this case it was called “Car”. For this discussion let’s assume that this entity has information about the cars that a person owns. In this example a person is equivalent to “Contact” in the standard Dynamics 365 Common Data Model. What we want to do is create a relationship between Contact and “Car”. In our example we will further assume that each Contact or person, can own more than one Car. This would mean that we have a 1 to Many relationships between Contact and Car. In Power Apps for Customer Engagement this type of relationship is called a 1:N.
What we want to enable is a 1:N relationship between Contact and Car, so that we can leverage our model and therefore our application, to assign one or more Cars to each Contact. To do this we need to first look at the second way to extend the Common Data Model using existing entities.
Before we can complete our previous Relationship example we will need to extend our new Application by adding the existing entity of Contact to it. This will allow us to create the relationship that we need without modifying the base solution of the system as mentioned before. We only need this relationship to exist if our application is installed.
Note: We are adding Contact to our example application because in the Health Accelerator Contact is leveraged for Patient, Practitioner and Related Person at this time. Within that entity we added a Contact Type option set. So right now we are effectively adding Patient. If you want to learn more, please check out the reference API documentation link at the bottom of this blog post.
Now that we have added Contact to our solution we can complete this example by creating the necessary relationship.
One we have created the relationship there is one more important thing to point out. When you created the 1:N relationship, you started from the Contact entity. You could have started at the Cars entity and created an N:1 and it would have done the same thing. In this case while we start at Contact if you go to the Cars entity and click the dark triangle to expand it. Then click on N:1 Relationships menu item, you will actually see that the relationship is listed there as an N:1. In this case I have filtered again by Custom so I can only see what I created. This is intentional so that the directionality of the relationship is correct.
Now that we have created our relationship, we have demonstrated one way in which we can extend the schema.
One additional example of extending the model would be to add new fields to existing entities such as contact. Image that you wanted to add more fields that you used to support your implementation of Patient. You would follow the same instructions given to add fields to your new entities. Those fields added to existing entities would show up under the “Custom” view with your prefix and name. This associates those fields only to your application and therefor only exist when your application is installed.
This first look at how to extend the Dynamics 365 Health Accelerator was focused on extending the Common Data Model for Health to create your own private Common Data Model extensions used by your own business application. We focused on how this was accomplished within the Dynamics 365 Power Apps for Customer Engagement UI. We created new entities, we added existing entities and we created new relationships between those entities. All of this exists as part of our custom application and are therefore part of our private Common Data Model extensions. Next, we will continue this series and focus on how to extend the Common Data Model by using the Power Apps for Canvas based applications UI.
Do you have sample data for this vertical
Hi Sajeer I released a tool to generate sample data and we are going to provide a sample data project