What comes to your mind when you realize you need to extend Dynamics with some server-side code?
- Custom workflow activities?
- External applications?
Those are all great options, but, for many years, they have been the only options available to us. And, yet, they all have limitations. Plugins can’t run on their own. Custom workflow activities have to run as part of the workflows. External applications need a server to run on. There is always a limitation.
But things are different now!
Have you tried Azure Functions yet? If not, you probably should.
For example, how about that famous “scheduled workflow” problem? It’s been bugging us since the early days of Dynamics, and there has never been a good solution. There is still no standard/simple solution in Dynamics, but stop thinking Dynamics.. think Azure/365.
You can create a timer Azure Function that connects to Dynamics, set up a schedule for that function, and voila.. Problem solved without any tricks.
How long does it take to create an Azure Function? Assuming you know how to write custom code for Dynamics and, also, assuming you have access to the Azure Portal with all the proper permissions, it does not take long. Took me about 1-2 hours without any previous experience in Azure Functions, though these three links were of great help:
Those links have all the information you need to create an Azure Function that connects to Dynamics, so it’s probably not worth it repeating all the same details in this post, but I’d like to summarize what I got, eventually:
- An Azure Function
- That uses CrmServiceClient to connect to CRM
- Then, it queries data from Dynamics using a FetchExpression
- Finally, it updates records in Dynamics
- And it is scheduled to run every hour
No need for a scheduled workflow.. no need for an external application.. No need for a dedicated server.. And this is not to mention it was unexpectedly easy to do it!