You Can Trigger A power automate flow by clicking a button in Power Pages. Just use the 'When A HTTP request is received' Trigger When Complete Your flow It will Automatically create an API. by using that API user can trigger the automate flow.
Just use this type of code inside a function a call the function inside the button on click:
function demoFnc(){
let xhr = new XMLHttpRequest();
var url =
"https://prod-24.centralindia.logic.azure.com:443/workflows/b4ba47e56a36454381250f2e43ea21d3/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=nkQoR39UW25u9kv3v01wXCGohjmD9A3CEHsrIgtY8Kw";
var data = JSON.stringify({
email: Email,
optionId: uniqueId,
});
xhr.open("POST", url, true);
xhr.setRequestHeader("Accept", "Application/json");
xhr.setRequestHeader("Content-type", "Application/json");
xhr.send(data);
xhr.onload = function () {
let response = xhr.responseText;
console.log(response)
}
}
Trigger Looks Like This:
