In this post, we will look at how to create a Power Automate Flow that alerts someone when a Power Platform Common Data Service version changes. This can be very useful if you’re waiting for new features to come out, for example the T-SQL access to the Common Data Service. We can also use this to connect to any of the D365 / Power Apps Web API methods from Power Automate. Let’s look at how to do this.
If you prefer video, check out this on my YouTube channel:
First, let’s look at versions of the Common Data Service. In the Power Platform Admin Center, we see there is a version listed in each environment:
Also, we can see the version through an app, by going to the Settings->About:
We see the Server version here:
Note these versions can be different, but that’s a story for another day.
Now, let’s say we’re waiting for version 18.104.22.16837 to come out, which is the version prerequisite for T-SQL access, according to this Microsoft documentation:
Let’s build the app that tells us if we’re at that version of not.
First, let’s create an Azure AD app and create a new client secret:
Set any duration and add:
Copy the value:
Now, let’s sign into Microsoft Power Automate at https://flow.microsoft.com and create a new Scheduled Flow:
We will call it Check Power Platform Environment Version, and schedule it to run every morning at 10am:
You will see:
Let’s add an HTTP action. This action will connect to our Azure AD app for the Power Platform / CDS environment and give us a bearer token to make Web API requests:
Enter the URI for the token request and the set the header to:
Set the body to below. This uses the Azure AD app Id and Secret:
&client_id=your application id from the Azure AD app
&client_secret=your secret from the client secret
Run this and copy the Body output.
Now let’s add a Parse JSON to get the bearer token from the response:
Add Body to the Content and click on Generate from Sample:
Paste the body output that was copied above and click Done:
We should see:
Add another HTTP action:
Paste in the URI of the Common Data Service Web API. Let’s look at a generic example first, getting all account data back – https://yourorg.crm.dynamics.com/api/data/v9.1/accounts
We will add the Bearer in the Headers for Authentication. Be sure to add a space between that and the access_token:
On running this, we see success:
And accounts returned:
Now let’s use RetrieveVersion to get the version number:
We see the version returned:
Make this the request URI:
Run it and copy the body:
We will add another Parse JSON to parse the response:
And we’re done with this action:
Now add a Condition:
We will check if the Version is greater than or equal to the version we are after:
Greater than or equal to:
If yes or no, we will send an email to a user:
With the version number:
It should look like:
Now it we run it, we get an email – the version is not yet what we want 🙁
If we change the version to a lower one, we will get a Yes email sent.
Hope you enjoyed!