Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - Customize & Extend
Answered

Issue when calling cloud flow error 400 Bad Request

(1) ShareShare
ReportReport
Posted on by 34

Hello,
I am having a weird issue when using a Power Automate flow from Power Pages.
In trying to troubleshoot it, I tried to create a simplified example of what I am trying to achieve.
In this example, I would like to pass a json object to the cloud flow.

For the sake of this example my json object is: {"emailAddress": "user@test.com","emailBody": "Hello World"}

I have created a cloud flow that accepts a json object, parses the json to extract email and sends an email to the email address and uses the second variable for the email body.
The flow has been tested by Manually inputting the Json object and it executed successfully.

If Iaunch the flow by clicking on the button on my page, the event triggers, but I receive and error 400 (Bad Request) if I have a send email action in the flow.

If I remove the send email action in the flow, when I look at the incoming parameters as received by the first action, all is fine:

 "body": {
 "siteId": "'.GUID",
 "siteUrl": "https://'mysite.powerappsportals.com",
 "userId": "00000000-0000-0000-0000-000000000000",
 "text": "{\"emailAddress\":\"user@test.com\",\"emailBody\":\"Hello World\"}"
 }

Here is the code I am using:

$(document).ready(function () {

 $('#i0o3hn').click(function () {
 var flowUrl = "/_api/cloudflow/v1.0/trigger/0c13ec47-d97a-58f5-10b8-332e9e18809f";


 var emailData = { "emailAddress": "user@test.com","emailBody": "Hello World" }; 
 var stringifiedEmailData = JSON.stringify(emailData);
 

 var data = {};
 data["text"] = stringifiedEmailData; 

 console.log("data",data);

 var payload = {};
 payload.eventData = JSON.stringify(data);

 console.log("payload:", payload);

 shell
 .ajaxSafePost({
 type: "POST",
 contentType: "application/json",
 url: flowUrl,
 data: JSON.stringify(payload),
 processData: false,
 global: false,
 })
 .done(function (response) {
 console.log("response", response);
 })
 .fail(function () {
 alert("failed");
 });
 });

});

If I was to remove the send email step of that flow and simply return the result of the parsed variables to my page, the values return correctly to the page in a console.log message. 

I have attached a screenshot of the flow I am using.

Thank you.

  • Dianey Profile Picture
    81 on at
    Issue when calling cloud flow error 400 Bad Request
    I'm having this issue now as well on a basically brand new v2 portal. Did you have to trigger an update for your portal?
  • Verified answer
    a365 Profile Picture
    34 on at
    Re: Issue when calling cloud flow error 400 Bad Request

    Hi all,

    Microsoft tech support confirmed that the issue was solved after a Microsoft update.

    The code in my initial post works correctly now since the update.

  • a365 Profile Picture
    34 on at
    Re: Issue when calling cloud flow error 400 Bad Request

    @Atmaram90  The connection reference used to send the email is already different than the run only user. At this point I have taken the issue to Microsoft support.

  • Atmaram90 Profile Picture
    125 on at
    Re: Issue when calling cloud flow error 400 Bad Request

    @a365 Please check which connection reference (run only user) is being used for the action send email. It should not be "provided by run only user"

  • a365 Profile Picture
    34 on at
    Re: Issue when calling cloud flow error 400 Bad Request

    When the error 400 triggers, the flow does not even execute. I know it is an error 400 by looking at the console in the developer tools of the browser.

     

    If I remove the step to send the email in the Power Automate, the flow executes fine and returns the info back to the page with a --> Return Values to Power pages action step that is in the screenshot I had in my original message. Without any changes to the code that is calling it, this is what is very weird.

     

    If I replace the email step by an HTTP post action to an external API, all works fine, I can return the response back to power pages. If however, I was to place another step between the starting Power Pages action and the HTTP action that would perform an unbound action to read environment variable or any other type of step, it throws that error 400. My example with wanting to trigger an email message is no exception.

     

  • Fubar Profile Picture
    7,964 Super User 2025 Season 1 on at
    Re: Issue when calling cloud flow error 400 Bad Request

    What happens if you copy the script provided by Microsoft and hard code your values in https://learn.microsoft.com/en-us/power-pages/configure/cloud-flow-integration#sample-javascript-to-call-a-flow

    (also note: in the sample, may need to add a back slash to before the _api )

     

    Edit: sorry didn't fully read your question, if the flow is triggering, are you sending a response back at the end of the flow? (if not try adding a Power Pages node at the end with a ->Return Values to Power pages action).  Does the flow run show as a success or a failure?

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 69 Super User 2025 Season 1

#2
oliver.rodrigues Profile Picture

oliver.rodrigues 49 Most Valuable Professional

#3
Jon Unzueta Profile Picture

Jon Unzueta 43

Featured topics