I have a flow that runs via a HTTP request:
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. Server Error
The flow does receive the GUID of the record
Im thinking it might be the brackets surrounding the GUID but im unsure how to remove them
Answer:
JSON needed updating:
"data": "{\"returnid\" :\ " " returnGUID " \ "}",
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,867 Super User 2024 Season 2
Martin Dráb 229,173 Most Valuable Professional
nmaenpaa 101,156