Re: Trigger Power Automate flow with Power Apps Portal Entity list action buttons
Hi @Anonymous
You can call Power Automate from Entity List by adding below javascript code in JavaScript Section:
$(document).ready(function () {
$(".entitylist.entity-grid").on("loaded", function () {
$(this).children(".view-grid").find("tr[data-id]").each(function (i, e){
var id = $(this).attr("data-id");
$(this).append("<td><input type='button' onclick='callPowerAutomate(\"" + id + "\");' value='Call Powerautomate' /></td>");
});
});
});
function callPowerAutomate(id){
var objInvoice = {};
objInvoice.invoiceid = id;
var stringJSON = JSON.stringify(objInvoice);
var httpTriggerUrl = "https://prod-29.westus.logic.azure.com:443/workflows/5192b9bc428746ec93b21e6c8f9d0fe7/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=";
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
datatype: "json",
url: httpTriggerUrl,
data: stringJSON,
async: true,
beforeSend: function (XmlHttpRequest) {
XmlHttpRequest.setRequestHeader("Accept", "application/json");
XmlHttpRequest.setRequestHeader("Content-Type", "application/json; charset=utf-8");
XmlHttpRequest.setRequestHeader("OData-MaxVersion", "4.0");
XmlHttpRequest.setRequestHeader("OData-Version", "4.0");
},
success: function (data, textStatus, XmlHttpRequest) {
alert("success");
},
error: function (xmlHttpRequest, textStatus, errorThrown) {
alert(xmlHttpRequest.responseJSON.error.message);
}
});
}
--------------------------
If you like this post, give a Thumbs up. Where it solved your query, Mark as a Solution so it can help other people!