Skip to main content

Notifications

Announcements

No record found.

Service | Customer Service, Contact Center, Fie...
Unanswered

Running Power Automate flow via button using Ribbon Workbench

Posted on by 310

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

  • G.Vetere Profile Picture
    G.Vetere 310 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans