How to Check If the Body is Empty in Power Automate?

One of my subscribers reached out a few days ago with an interesting query. They were working on a Power Automate flow and needed to check if the Body of a response or action was empty before proceeding. This is a common scenario, especially when dealing with APIs and HTTP requests where data may or may not be returned.

In this tutorial, I will explain how to check if the Body is empty in Power Automate using simple conditions. Additionally, I will explain a situation where the Send an email (V2) action may seem empty but still allows the flow to save due to a hidden blank line.

Check If the Body is Empty in Power Automate

Imagine you have a Power Automate flow that uses the Send an HTTP Request to SharePoint action to retrieve data, such as item details from a SharePoint list. Sometimes, the response might return an empty body if no matching data exists.

For this example I have a SharePoint list called Employee Records with columns like:

  • Employee ID (Single line of text) — Unique identifier
  • Employee Name (Single line of text)
  • Department (Choice)
  • Date of Joining (Date and time)
  • Employee Status (Choice)
  • End of Contract (Date and time)
Power automate IF the body is empty

In this example, we will attempt to fetch employee details based on an Employee ID. If no matching data exists, the response body will be empty, and you will notify the user accordingly.

To do this, follow the below steps:

1. Create a new Instant Cloud Flow and choose Manually trigger a flow as the trigger. Then, expand the trigger action and add a Text input field where we can provide Employee ID.

How do you check if a body is empty in Power Automate

2. Then add a Send an HTTP request to SharePoint action from sharePoint Connector with the below parameter:

  • Site Address: Select the SharePoint Site Address
  • Method: Select “GET” as the method
  • URI: Provide the below URI:
_api/web/lists/getbytitle('Employee Records')/items?$filter=EmployeeID eq '@{triggerBody()['text']}'
  • Header: Use the below headers to make REST API calls to SharePoint:
{
  "Accept": "application/json;odata=verbose"
}
How to use empty condition in Power Automate

3. Add a Condition to Check if the Body is Empty and provide the below expression:

  • In the left side, use this expression:
empty(body('Send_an_HTTP_request_to_SharePoint')?['value'])
  • In the middle, select is equal to.
  • In the right side, enter true.
Check If the Body is Empty in Power Automate

4. In the true condition add a Send an email action with a message like to the person who added the user:

No employee record found for Employee ID: @{triggerBody()?['text']}
Power Automate Check If the Body is Empty

Now, click Save and run the flow manually. It will ask for the Employee ID, which you should provide (in my case, 123). After the flow runs successfully, click Run Flow. You can see the true section send an email action run, meaning the Employee ID is not in the Sharepoint list. Then, the person will receive the email.

How to Check If the Body is Empty in Power Automate?

With the help of the empty() function in Power Automate, you can quickly check if the Body is Empty in various scenarios. For example, you can use it to verify if a Select action returned no data, an HTML table is empty, a Filter Query found no matching records, or a Get items action didn’t retrieve any items. Once you confirm that the Body is Empty, you can add actions like sending a notification, creating a log entry, or handling the missing data appropriately.

Send an Email If Body is Empty in Power Automate

We recently encountered a situation where the “Flow can be saved” even though the Body content hadn’t been filled. One of my subscribers asked how this was possible since the Body is a required field in some actions like Send an email (V2).

In most cases, if the Body field is left empty in the Send an email (V2) action, the flow will fail because the Body is mandatory.

Send an Email Body is Empty in Power Automate

After checking their flow, I found they added a new line in the Body field. This made it seem empty, but since there was a blank line, Power Automate treated it as filled and allowed the flow to save.

I switched to the Classic designer and then changed the Body field to HTML format to check this.

 Power Automate Send an Email Body is Empty

Conclusion

In this tutorial, I covered two key scenarios related to checking if the Body is empty in Power Automate. First, I explained how to use the empty() function to check if the Body of a response, such as data from a SharePoint list, is empty and notify the user if no matching records are found.

Second, I explained a situation where the Send an email (V2) action allowed a flow to save even though the Body field appeared empty, this happened because a blank line was added, which Power Automate treated as filled content.

You may also like:

Power Apps functions free pdf

30 Power Apps Functions

This free guide walks you through the 30 most-used Power Apps functions with real business examples, exact syntax, and results you can see.

Download User registration canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App