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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / What is the best way t...
Power Automate
Unanswered

What is the best way to check if the Get Items return value

(0) ShareShare
ReportReport
Posted on by 1,811 Super User 2024 Season 1

I am working on power automate flow, which have this Get Items action from SharePoint:-

 

johnjohnPter_0-1705111254150.png

 

so how i can check if the get items return at least one item?

now based on my test if the GetItems return values >> the output will be as follow:-

 

johnjohnPter_2-1705111402913.png

 

 

while if it is empty the output will be as follow:-

 

johnjohnPter_1-1705111381229.png

 

any advice how to check if the GetItems return atleast one item inside my flow?

 

Thanks

 

Categories:
I have the same question (0)
  • creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at

    @johnjohnPter Your Get Items action isn't returning anything. [] means no items were found. Your Filter Query is incorrect. Where are you getting the ID dynamic content from? What does the rest of your flow look like?

     

    I would recommend adding a Compose action after a Get Items action to store the number of items returned. However, in your case the number will be zero.

     

    Whenever I use a Filter Query in a Get Items action, I always like to return the count of items returned in a Compose action. This is helpful when building a flow and can also be used to troubleshoot your flow.

    Insert a Compose action. Add an Expression. Use the length() function.

    creativeopinion_0-1705115430794.png

    Select the Dynamic content tab and insert the value dynamic content from the Get Items action into the length() function.

    creativeopinion_1-1705115449119.png

     

    For more flow troubleshooting tips—check out this YT Tutorial: 5 Power Automate Troubleshooting FAQs and Helpful Tips for Creating Better Flows

    In this tutorial I cover:

     How to troubleshoot a false Condition action result

     How to get dynamic content when it isn’t selectable from the list of dynamic content

     How to troubleshoot an Apply to Each action that isn’t looping through

     How to troubleshoot a skipped Apply to Each action

     How to troubleshoot a Filter Query

     How to use a SharePoint yes/no column in a Filter Query

     How to use Compose actions to troubleshoot a Power Automate flow

    How to troubleshoot multiple emails being sent

     How to troubleshoot multiple Teams messages being sent

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response! 

    👉Watch my tutorials on YouTube
    👉Tips and Tricks on TikTok

  • johnjohnPter Profile Picture
    1,811 Super User 2024 Season 1 on at

    @creativeopinion why my filter query is incorrect? and why i need to get the number of items... i did not get your answer..

  • creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at

    @johnjohnPter 

    The reason I suggested that you check the number of items is because I read your original post as wanting to check how many items were returned. However, I must have misunderstood your original post.

     

    Did you want to only return a single item from the Get Items action? If so, then you ned to se the Top Count to 1. 

    creativeopinion_0-1705162684243.png

     

    However, even if you return a single item from the Get Items action. It will return an Array of items even if you specify to return a single item. Because of that, if you try to use any dynamic content from the Get Items action, it will automatically be nested inside an Apply to Each action.

     

    To avoid the Apply to Each action you'll need to use an expression to get the dynamic content. I cover that in this YT Tutorial: 3 Mistakes YOU 🫵 are Making with the Apply to Each Action in your Microsoft Power Automate Flow

     

    In this video tutorial I’ll go over how to avoid these common mistakes when using the Apply to Each action in a Power Automate flow:

     

    1️⃣ Looping through a Single Item

    2️⃣ Creating Unnecessary Nested Loops

    3️⃣ Looping through an Unfiltered Array

     

    At the end of the video I share a few helpful insights when it comes to using the Apply to Each action in your flow.

    I'll also cover:

     How to avoid the Apply to Each action with a single item array

     How to use the item() function to access dynamic content in an array

     How to prevent unnecessary nested Apply to Each action loops

     How to use the Select action

     How to convert an array to a string with the Select action

    How to use the Filter Query field

     How to count the number of items in an array

     How to use a condition control

     How to use the concurrency control

     How to set a top count

     How to use Compose actions for troubleshooting

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response! 

    👉 Watch my tutorials on YouTube
    👉 Tips and Tricks on TikTok

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @johnjohnPter,

    To check if the GetItems return atleast one item, you could add a condition:

    vqiaqimsft_0-1705287187373.png

    length(outputs('Get_items')?['body/value'])

     And compare the retunred total with 1.

     

    Further more, we need to check one by one from the outputs of the Get items so that we could know how many items it returns.

    If it returns empty, we could find it directly based on the "[]".

     

    In a word, we need to add a condition to check the result directly.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard