Use Flow to monitor multiple D365 instances

If you are supporting multiple instances of D365 in your tenant you have likely had to check in on them and take a peek at the System Jobs to make sure everything is running smoothly, and cringe when you get there and find a ton of failures from a workflow or a plugin.

Now, within the new Power Platform Admin Portal you can bring up the Analytics Dashboard to do the same thing, however, this still means you have to switch to each environment to see what is happening.

So I decided to drink in the Microsoft Flow Kool-aid and see what it could do.  I started with the template (Receive a weekly email summary of new dynamics 365 opportunities) to get a feel of the landscape, and ironically, this actually satisfied a request I had from a client earlier.  So it was a win-win right out of the gate!

What it does out of the box

  • Triggered at set intervals with Recurrence
  • Fetch data from Dynamics 365 based on a date parameter with Get Past Time and List Records actions.
  • Format the results into a readable format and email them out with the ‘Create HTML Table’, ‘Get My Profile’ and ‘Send an Email’ actions.

With a couple quick updates we can modify this to grab data across multiple D365 instances.

Update the list records parameters

For this I went to the trusty XrmToolBox and started up the FetchXML Builder.  After you build up your FetchXML query it will now show you the Flow List Parameters and with a single click, you can copy each of them to your clipboard to make it very easy to paste into the list records parameters in Flow.

p1_fetchxmlbuilder

Parallel Branches

Flow allows you to have multiple branches to execute in your flow, which allows you to have multiple threads of independent actions executing at once.  In my case, I wanted to fetch the failed system jobs across multiple environments, so I added in multiple parallel branches, I can tap into each of those environments.  This could have been done sequentially of course, but the parallel branches looked cool to use.

p1_parallelbranch

So this is the full view of the flow in action. You can update Recurrence trigger to fire based on the frequency you want to receive the system jobs from as many environments you want all packed into one email.

p1_Overview

Next Steps

  • Add some conditions around the List Records to only build the HTML table if there are records to match the query.
  • Improve the HTML in the email to perhaps using a template to better present the data.

How do you monitor your system jobs?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s