In this Blog, we will discuss about how to trigger a power automate flow with ribbon button using java script action.
Login into power automate using “Make.Powerautomate.com”.
Create an instant cloud flow using “when an http request received ” trigger. as shown below .
Take “when a HTTP request is received” and save it to get the HTTP POST URL and Copy it.

Copy the Url and save it in notepad for reference.
Login in to MSCRM and navigate to Advanced settings in advanced settings navigate to settings ->customizations->Solutions.
In solutions select solution that you want to customize
In the solution navigate to webresource.
Create a web resource using below code.
function Response(formContext) {
var value = formContext.getAttribute(“schema name of the feild”).getValue();
var value2 = formContext.getAttribute(“schema name of the feild”).getValue();
var params = {
“Value”: value,
“Value2”: value2,
}
var url =”Pass http url that u have copied from the powerautomate trigger”
var req = new XMLHttpRequest();
req.open(“POST”, url, true);
req.setRequestHeader(‘Content-Type’, ‘application/json’);
req.send(JSON.stringify(params));
req.onreadystatechange = function () {
if (this.readyState === 4) {
req.onreadystatechange == null;
if (this.status == 200)
{
var result = this.response;
alert(“” + result)
}
else if(this.status == 400)
{
alert(this.statusText);
var result = this.response;
alert(“Error” + result);
};
}
}
}
save and publish the web resource.
Now create a Ribbon button.
create a new command with the java script action and add the Webresource to that command and pass the parameter as a Primary Control.
Add the command to the ribbon button that we have Created.
Publish the customizations of RibbonworkBench.
Test the customizations in the app .
Now see the flow trigger and retrive the values of the input that we have given.
For any Help or Queries Contact us on info@crmonce.com or +918096556344