Hi Everyone,
We all know how Power Automate or Microsoft Flows are changing the way we design the things in Dynamics 365 CE. Recently, we got a requirement to call Microsoft Flow from a button click on Dynamics 365. Here is the way we did using JavaScript.
Let's create a flow as below.
1) Take the trigger as HTTP Request received
2) Generate Schema accordingly to your input, I just have AccountID as an Input so taken JSON as below to generate schema and declare the method as POST.
{"AccountId": "abc"}
3) I just added one step of Variable as once the flows is triggered from the JavaScript, we can add the steps as per our requirement.
4) Save the flow and get the URL from HTTP Trigger (first step)
5) Here is the JavaScript code for calling flow.
Hope this helps.
--
Happy 365'ing
Gopinath.
We all know how Power Automate or Microsoft Flows are changing the way we design the things in Dynamics 365 CE. Recently, we got a requirement to call Microsoft Flow from a button click on Dynamics 365. Here is the way we did using JavaScript.
Let's create a flow as below.
1) Take the trigger as HTTP Request received
2) Generate Schema accordingly to your input, I just have AccountID as an Input so taken JSON as below to generate schema and declare the method as POST.
{"AccountId": "abc"}
3) I just added one step of Variable as once the flows is triggered from the JavaScript, we can add the steps as per our requirement.
4) Save the flow and get the URL from HTTP Trigger (first step)
5) Here is the JavaScript code for calling flow.
function callFlowFromJavaScript() {
var flowUrl = "FLOW URL";
var input = JSON.stringify({
"AccountId": "475b158c-541c-e511-80d3-3863bb347ba8"
});
var req = new
XMLHttpRequest();
req.open("POST", flowUrl, true);
req.setRequestHeader('Content-Type', 'application/json');
req.send(input);
}
To Configure Flow URL in a best way, you can read this Post.Hope this helps.
--
Happy 365'ing
Gopinath.
No comments:
Post a Comment