Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Web resource button to trigger a Power Automate Flow

$
0
0

Hi I have created a button with an HTML resource and I need it to post the entity GUID to a Power Automate flow with a "When a HTTP request is received" trigger.

I'm using postman to do testing, which is working, but the code that I use from it is not, can someone please help?

Code:

<html><head><script type="text/javascript">
        function PostFlow(formContext) {
            var quote = formContext.GetAttribute('quoteid').getValue();
            var myHeaders = new Headers();
            myHeaders.append("Content-Type", "application/json");

            var raw = JSON.stringify({ "quote": quote });

            var requestOptions = {
                method: 'POST',
                headers: myHeaders,
                body: raw,
                redirect: 'follow'
            };

            fetch("https://prod-15.australiasoutheast.logic.azure.com:443/workflows/911152d4c715473cb501a6bb02a4bd92/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=gCbQugknr8h_1IQoLOmDuUhncJv0IOKuQCbI2UWNwYk", requestOptions)
                .then(response => response.text())
                .then(result => console.log(result))
                .catch(error => console.log('error', error));
        }</script><meta charset="utf-8"></head><body><button onclick="PostFlow()" style="background:linear-gradient(to bottom, #fafafa 5%, #ffffff 100%);
	background-color:#fafafa;
	border:1px solid #000000;
	display:inline-block;
	cursor:pointer;
	color:#000000;
	font-family:Trebuchet MS;
	font-size:13px;
	font-weight:bold;
	padding:6px 12px;
	text-decoration:none;">Calculate Totals</button></body></html>

Dynamics 365 Sales Professional - "crm6"


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images