By Steve Drake, Director, Technology at TrueNorth IT.
In the past we have built CRM (Dataverse) portals using Microsoft’s PowerApps Portals. We have even blogged about it.
But often you cannot deliver exactly what the user wants with PowerApps Portals. Sometimes we need a more code-focused solution and one that our Dataverse developers will be familiar with.
What do our Dataverse Developers Know?
Did you say NODEJS?
The following code will read Global OptionSet from the DataVerse:
And, if we want it to run from an Azure Function running NODEJS, it’s just:
Yes, it’s really that simple.
What about the frontend?
Most developers who can build websites will have a chosen framework: Vue, React or Angular. Any of these can be used to build a rich web application and any of these can consume our very simple NODEJS API. It’s just very basic REST HTTP calls.
Why not go direct to CRM?
We could go direct to CRM from our website, but this would be insecure in some cases.
What about hosting?
Microsoft have just launched Azure Static Web Apps. These let you host a single page application website, along with an API built with Azure Functions, for about £5 per month!!! That £5 per month includes compute time to execute the functions. If you need more, such as durable functions, then you can host them yourself on their own Azure Function resources. If we continue with the serverless model your costs will not jump up, we can still keep the costs to less than £10 per month for most basic portals.
And what about security?
With this approach, the Azure Functions connect to the Dataverse using an application account, so you can restrict what the API can consume with standard security roles. The NODEJS API can add further filtering based on the user’s interaction with the API. For some projects, it’s a public API, but often it’s protected with a simple login. When we have a user context we can add filtering based on the user interacting with the API. Maybe they can only view forms they submitted, maybe they can re-submit a form after it’s been rejected, or maybe they can see the status of a form.
To get started with Azure Functions, have a look at have a look at this Microsoft guide.