How to run Microsoft Flow through Custom Ribbon Button using http request

By | October 28, 2019

Introduction:

Microsoft Flow is a Microsoft service which works as middle ware in different platforms and allows to perform many operations in Dynamics 365 CRM that is similar to workflows.

In this blog, we will see how we can run the Microsoft Flow directly from the custom button of Dynamics 365 CRM.

For example, we have a requirement to run the Microsoft Flow in custom button directly or after doing any operations.

In order to achieve this, follow the steps given below:

Step 1: – Create Microsoft instant Flow and select ‘When an http request is received’.

Step 2: – After creating the Flow, set a unique name for the current Flow. Next, add JSON schema as per the data you want to receive or generate by clicking on use sample payload to generate schema.
In this blog, we will be passing JSON object to the request as given below:

Step 3: – Add composer to store data that has passed to the request from Dynamics 365 CRM.

Now save the Flow and copy URL of http request which is going to be used in script on custom ribbon button.

Step 4: – Create a script file and add the JavaScript function for custom button.

Step 5:- On click of button, script function will be called and http request will be executed. To run Microsoft Flow the process is as follows:

  1. Create a JSON object as data and make sure to provide the same property as we have in Microsoft Flow.
  2. Set the http request URL which we have copied in step 3 from Flow.
  3. And once we get the success status from the request we will be showing a popup message or you can have your own logic as per your requirement.

Step 6: – Add custom button on the entity on which you want to run the Flow. We have added a custom button on account entity by using ribbon workbench and on click event we have selected the script and script function created in steps 4 & 5 as shown in the following screenshot:

Step 7: – Now go to the entity and click on the custom button. Here is our Flow which ran successfully.

Conclusion:

Thus, with ‘When http request receive’ connector we can run Microsoft Flow by executing the http request from custom ribbon button.

70% of global 2000 companies apply gamification to improve productivity and returns!

Gamifics365 – Spin the magic of games within Microsoft Dynamics 365 CRM to improve user adoption, enhance productivity, and achieve company goals!

2 thoughts on “How to run Microsoft Flow through Custom Ribbon Button using http request

  1. shubham jain

    I have created a Flow on “HTTP request received” and using JavaScript on button click I am passing this HTTP URL to trigger the flow.
    In that JavaScript i have provided HTTP trigger URL in static way.
    But when I deployed in target environment the HTTP URL Got changed and I need to modify the URL in that JavaScript, but we don’t want to do unmanaged changes on our target environment.

    Is there any way to construct that HTTP trigger URL in JavaScript?
    or what I need to do to resolved my issue?

    1. Inogic

      Hi,
      As per our understanding the issue you are facing is that in target environment you are not able to execute the correct Power Automate Flow and you don’t want to do script changes on your target environments too.
      What you can do here is – You can store the URL somewhere like any configuration record that you have and read that on to your script and then execute the Flow.

      Hope this helps!

Comments are closed.