top of page

Call a Power Automate Flow from Custom button in Dataverse/CDS/D365

Power Automate has a lot of advantages over Classic Workflows. I’ve given presentations on this topic and it’s an ongoing conversation piece in the community, of what everyone should be using. I’ve made a commitment to only build Power Automate Flows and NOT Classic Workflows anymore and it’s something I’m sticking to. One request on a lot of projects is the ability to click a button and some sort of automation happens. This has been available in Dataverse/CDS/D365 by choosing Run Workflow and choosing from a list but sometimes this is too many clicks or too complicated. This is where the Ribbon Workbench by Scott Durow is one of the best community tools available.

Scott Durow is a Microsoft MVP and the genius mind behind Sparkle XRM and the Ribbon Workbench. He is also the Chief Technology Officer and Co-Founder of Sales Spark, a new ISV for the Power Platform and D365 Sales, to turbocharge your sales. As a side note, Scott is the nicest guy you will meet.

Recently Scott has released an update to his SmartButtons solution, an addition to his Ribbon Workbench Tool which allows you to add buttons into Dataverse/CDS/D365’s Unified Interface, to do certain actions. These actions include running Reports, Workflows, JavaScript and a Webhook. The Webhook is what we are going to focus on because, if you have watched this video on my YouTube Channel, you will know that you can trigger a Flow to run.

THIS….IS….AMAZING news!! I don’t know how many implementations I've done where the customer has asked for just a single click button to run a workflow, but having the ability to do this using Power Automate is incredible. This opens up so many opportunities for us to do things using Flows. I thought, wouldn’t it be cool if we could run a flow on an account, take the address details, pass it to bing maps, retrieve the longitude and latitude and then update the record in Dataverse/CDS/D365. This blog is designed to help guide you through the process.

Firstly, download the smartbuttons solution from here and import it in your Dataverse/CDS/D365 instance. To do this, go to and navigate to solutions and choose “import” and follow the steps to install this solution.

Next you can either install the Ribbon Workbench solution into your environment or use the XrmToolBox tool for the Ribbon workbench, my default is always the XrmToolBox version. Details of how to install and use this can be found on the XrmToolBox site so I won’t go into configuring this.

Once you are all set up with these, it’s time to build your Flow! Go to Power Automate and create your Flow, which needs to be an “Automated - from Blank“ Flow. For the trigger, type in “request” and choose the “When a HTTP request is received” trigger.

You’ll notice the top of the trigger says the “URL will be generated after the save” which means we need to save the record, to retrieve the URL (webhook) we want to call.

Next, we need to write some JSON to retrieve the ID of the record or records we are running this Flow on, we’ll use this in the next step and it’s what we can use to identify the records up to update. Don’t worry, I’ve got the JSON right here:


"type": "object",

"properties": {

"id": {

"type": "string"




Once you have pasted this in, we are going to use the Dataverse/CDS “Get record” action so that we can use some data from the records you want to run this on. In my example, i’m using the account record, but you can just select the entity you are using and then the identifier is the ID from the dynamic content.

Next I’m going to use the data from the “Get Record” step and i’m taking the address details to pass to bing maps. N.b if you want to use bing maps in Power automate, you need an API key, but you can request one for free from the bing maps site, instructions here.

Add the bing maps action “Get location by address (preview) and fill in the address details using the dynamic content. You do need to bring in a country code for Bing maps, so in a real data scenario, you may need to update your data somehow. In my example, I’ve just hardcoded GBR as my country code.

That’s going to give us access to a bunch of features from Bing maps including the longitude and latitude. Use an “Update a Record” CDS action, use the ID from the request as the identifier and then update the longitude and latitude fields using the dynamic content.

The last thing we need to do in this Flow is create a Response action, this will tell Dataverse/CDS/D365 if the Flow ran successfully.

With your Flow complete, save and you will now get a URL in the trigger. We will need this for the next step.

Open up the Ribbon Workbench and load up a solution which contains the entity you want to edit. It is highly recommended that you use a solution containing just the entities you want to edit and nothing else. Also, you should have a backup of your Ribbon before you make any changes.

In your solution, select the entity you want to add the button to and then you should see the “Run Webhook” button under the smart buttons section. Click and drag this onto the ribbon you want to add this button to the form, a subgrid or home (which is the main screen where you select your views and see a list of records). When you drag it to the place you want it, you should see the popup below.

Fill in the boxes and press OK.

Title = Name of the button to be displayed on the ribbon

Web Hook URI = The URI you got from saving your flow

Start Confirmation Text = (optional) Text to be displayed to the user before asking them to confirm the running the web hook action

Success Callback JavaScript = JavaScript which handles the a successful outcome

Error Callback JavaScript = JavaScript which handles the an unsuccessful outcome

In case you need it, like I do, here’s some JavaScript for the success or error callbacks.

Xrm.Navigation.openAlertDialog({ text: "Record Updated"});

You can obviously write better JavaScript than the above, but if you just want an alert, this will do the job. #NotADev

Click OK and click publish.

Switch back to Model Driven Apps and navigate to Accounts. You should now see your custom buttons on the ribbon. Clicking on the button, it sends the request off to Power Automate, it will do all the actions (in this case, looking up the longitude and latitude) and then right back to the account record.

Ciao for now!

bottom of page