web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Unanswered

Running Power Automate flow via button using Ribbon Workbench

(0) ShareShare
ReportReport
Posted on by 8

I have a flow that runs via a HTTP request: 
pastedimage1625839041645v1.png

My button is set on a custom  entity "Return"

javascript used to call the flow:

function callFlow(primaryControl) {
	var formContext = primaryControl;
	var returnGUID = formContext.data.entity.getId();
	var returnGUID = returnGUID.replace('{', '').replace('}', '');

	if (typeof($) === 'undefined') {
		$ = parent.$;
		jQuery = parent.jQuery;
	}

	var settings = {
		"async": true,
		"crossDomain": true,
		"url": "REDACTED LINK",
		"method": "POST",
		"headers": {
			"Content-Type": "application/json",
			"cache-control": "no-cache",
			"Postman-Token": "217c65f0-99d5-4283-8361-6a9e639c9a0b"
		},
		"processData": false,
		"data": "{\n	\"returnid\": \"("   returnGUID   ")\"\n}",
		"beforeSend": function() {
			Xrm.Utility.showProgressIndicator("Return is being submitted.");
		},
        "complete": function() {                    
        }
	}

	$.ajax(settings).done(function(response) {
		console.log(response);
		if (response.StatusCode == "SUC-999") {
                Xrm.Utility.closeProgressIndicator();
		} else {
               var alertStrings = {
				confirmButtonLabel: "OK",
				text: "Error code:  "   response.StatusCode   "\n"   "Error description:  "   response.StatusDescription,
				title: "There has been an error!"
			};
			var alertOptions = {
				height: 100,
				width: 200
			};

			Xrm.Navigation.openAlertDialog(alertStrings, alertOptions);
			Xrm.Utility.closeProgressIndicator();
		}
	formContext.data.refresh();
	});
}

When i click the button, i check the flow and its failing

Get a 404 error:




404 - File or directory not found.




404 - File or directory not found.

The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.

The flow does receive the GUID of the record

pastedimage1625839201227v2.png

Im thinking it might be the brackets surrounding the GUID but im unsure how to remove them

I have the same question (0)
  • G.Vetere Profile Picture
    8 on at
    RE: Running Power Automate flow via button using Ribbon Workbench

    Answer:

    JSON needed updating:

    "data": "{\"returnid\" :\ " " returnGUID " \ "}",

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 42 Super User 2025 Season 2

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 35

#3
CU29080825-0 Profile Picture

CU29080825-0 16

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans