At work recently, I’ve been put on a project which is a big custom calculator built in a Canvas App, storing data in CDS. As I've been building, I've noted some interesting differences from model-driven app building and design to canvas. While this is to be expected, I’ve found myself rethinking my design choices and how I build apps in general.
At the same time I’ve been reaching out to the community for advice and assistance more but as with Power Apps, there’s two main sides to the community, the Office/Microsoft 365 side who build Canvas Apps with SharePoint Lists, Excel or Azure SQL mainly, and the D365 model-driven app builders. So finding good people/resources on building Canvas Apps with CDS is difficult. I put out a tweet.
As you can see from the reactions, I think this is something that might benefit these two sides to the community. This blog posts and the ones that follow will be focused around CDS, some basics and best practices and how you can build Canvas Apps with CDS and things you need to know. The idea:
Learn from both sides. Learn about CDS from an Office/Microsoft 365 side and learn about Canvas Apps with CDS from a D365CE side. We’ll also cover a few other bits along the way like SharePoint, but I will rope in some friends/experts for that.
I thought I would start from the beginning with, What is CDS?
CDS stands for the Common Data Service, not Common Data Source. The Common Data Service is much more than just a database, much more than just a place to put your data. The CDS firstly gives you access to the Common Data Model, a data model built in conjunction between Microsoft, Adobe and SAP with a list of common entities (record types) that most organisations would use, as well as a common naming convention. Entities such as Account, which represents a company, business or organisation or Contact which represents an individual; means that as soon as you get a CDS database, you get access to all these pre-built entities and fields.
Already this is a massive time saver, you don’t need to write SQL scripts to create all the tables and columns you need to store data, you have it there ready. If you don’t need one or more of these entities, you can simply not use them and create your own. Yes, you read that right, you can create your own, again not through SQL scripting, but from an easy to use UI. You can create your own entities, create fields for those entities, specify the data type for these fields, how many characters they are and the platform goes away and creates those tables and columns for you.
This is actually one of the reasons the CDS exists and it’s probably important to talk about the history of CDS at this point as well. The CDS, or CDS 2.0 if you want to be technical about this, is an extension of the idea of XRM, taking a Customer Relationship Management system (CRM) and extending it (that’s the X part) to fit your business needs. Dynamics CRM or Dynamics 365 Customer Engagement or D365 Sales/Customer Service or basically whatever Microsoft are calling it these days; is a fantastic platform to build and extend upon. For this fact, people over the last 15 years have been extending D365 (CRM) to do, not only more than what is intended, from a Sales, Customer Service or Marketing perspective; they have built membership management systems, Event Systems, HR systems and many other types of systems.
Microsoft saw what people were using this for and made the CDS v1 which wasn’t very good and didn’t get adopted by many people. Then a couple of years ago Microsoft released the CDS 2.0 and it was finally the XRM people had been shouting out for. An extendable database but with all the benefits you get with D365 (CRM).
Back to the CDS benefits, as we are talking about databases, the CDS is a relational database so let's talk a little bit about why that is important, because it is IMPORTANT!!
A relational database lets you connect data to 1 or more tables in your database, what this means is you can have a single Contact record in your system and you can connect it to an Account to show that the Contact works for that organisation. Then you can connect that same Contact to an Event Attendance record, to show they are attending a certain Event, which again is another record. So you’ve just connected a single record to 2 other records, without the need to duplicate data anywhere. You can report all the way through this trail, see which Events Contacts are attending, see which Accounts are attending a certain event. And this keeps records of everything because of these relationships. That is sooo freaking powerful!!!
We’ve covered the Common Data Model, extending and customising entities and relational databases, but this is just the tip of the iceberg, these are some basic features of CDS, we haven’t even gotten to the really cool bits.
Security! Everyone needs their systems to be secure and the CDS is no exception. Even though we live in the digital revolution and we take a lot of security aspects for granted when we are in the Microsoft ecosystem, security is a big thing. I’m not talking about security to actually access the CDS system, that is all covered by Microsoft so that’s cool (Chris Huntingford once said that everyone should move to the cloud because Microsoft secure your data with Ninjas and Pitbulls) but what i’m referring to is entity level and in places, field level security.
You can handle security for CDS at an entity level, meaning if you have users that never need to see a particular record type, says Customer Service representatives never need to see orders or invoicing, you can remove that ability. Similarly, if you need to restrict users from Creating records, Deleting, Sharing, Editing...you can do all this. There is even more complexity to this which means you can allow users to only see records they’ve created, or not share records they haven’t created, or not update records which don’t belong to them or the team they are in. There are so many possibilities and the security aspects alone is incredible.
What’s even better is that this is all done through a WYSIWYG editor, choosing if a Security Role can do a certain thing, then you assign users that security role. It’s so simple to handle. I know permissions for SharePoint need to be manually configured, sometimes at folder level to get security right. Whereas you may have ways to automate all this, the security method through CDS has always given me so much control, while the platform handles the enforcement. There is also the idea of field security as well, allowing you to hide/show data to only authorised users in the system with configurable rules around letting users input the data on create, not allowing users to input or view it at all, and letting certain users edit.
The SDK and API are two fantastic aspects of the CDS. While the SDK is more of a model-driven app device, it’s important to document why it’s an incredible tool. The SDK has been available in Dynamics 365 for years, giving developers the ability to create plugins and trigger different actions programmatically; allowing to extend the platform to fit nearly all scenarios. The API is a thing of beauty. API’s allow you to access data and perform actions from outside of the platform. This means you can trigger an update in CDS from an external web service connected to an on premise database...as just an example. But the best bit of the API…
It is self generating!!
What does that mean? It means, you don’t get access to data and actions only in the core system, i.e. only default entities. It means if you create a new entity, that is something you can query. This, this is the true power here!! A fully extendable system, with a self generating API, means whatever you need to build in CDS, you can then either pull data out or write data into these entities from another system if you want to. These things give you limitless possibilities.
Here are just a few other fantastic features of CDS:
Automation (through classic workflows and Power Automate)
Reporting (Built in, Power BI, Reporting services)
Data Loss Prevention
There are lots of great articles on What is CDS, here are some of my favourites if you want more detail, but I hope this is a good introductory overview.
Stay tuned for more articles so you can Learn from both sides.
Ciao for now!