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 / Power Automate Flow Is...
Power Automate
Unanswered

Power Automate Flow Issue: Condition Always Returning False

(0) ShareShare
ReportReport
Posted on by 68

Hello guys, I need help bacause I'm stuck with this flow that make me crazy. 

 

I have created a Power Automate flow with the following structure:

  1. Trigger: Manually trigger a flow.
  2. Action: List tasks from Planner.
  3. Action: Get items from a SharePoint list.
  4. Condition 1: Check if the SharePoint list is empty.
    • If true: Do nothing.
    • If false: Apply to each item in the SharePoint list.
      • Apply to each task in Planner:
        • Condition: Check if the task title matches the item ID.
          • If false: Create a new item in the SharePoint list with the task details.

The goal of this flow is to write to the SharePoint list only the tasks that are updated in Planner. However, I am facing an issue where "Condition 1" is supposed to check if the SharePoint list is empty but it always returns false, even when the list is empty.

Here is the relevant part of the flow definition:

 

{
  "Condition_1": {
    "actions": {
      "Apply_to_each": {
        "foreach": "@outputs('Get_items')?['body/value']",
        "actions": {
          "For_each": {
            "foreach": "@outputs('List_tasks')?['body/value']",
            "actions": {
              "Condition": {
                "actions": {},
                "else": {
                  "actions": {
                    "Create_item": {
                      "type": "OpenApiConnection",
                      "inputs": {
                        "parameters": {
                          "dataset": "https://nnm4.sharepoint.com/sites/HelpDesk",
                          "table": "c80939a9-f7f0-4a8a-bdf0-8bf510ee7091",
                          "item/Title": "@item()?['id']",
                          "item/BucketPrecendente": "@item()?['percentComplete']",
                          "item/UltimoAggiornamento": "@item()?['createdDateTime']",
                          "item/Titolo": "@item()?['title']",
                          "item/{ContentType}/Id": "0x010095431D778506AE4E9E342C093A099508005615322569FA3749B8BEB82AE545BF6C"
                        },
                        "host": {
                          "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline",
                          "connectionName": "shared_sharepointonline",
                          "operationId": "PostItem"
                        },
                        "authentication": {
                          "value": "@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']",
                          "type": "Raw"
                        }
                      }
                    }
                  }
                },
                "expression": {
                  "or": [
                    {
                      "equals": [
                        "@item()?['Title']",
                        "@item()?['id']"
                      ]
                    }
                  ]
                },
                "type": "If"
              }
            },
            "type": "Foreach"
          }
        },
        "type": "Foreach"
      }
    },
    "runAfter": {
      "Get_items": [
        "Succeeded"
      ]
    },
    "else": {
      "actions": {}
    },
    "expression": {
      "and": [
        {
          "equals": [
            "@equals(length(outputs('Get_items')?['body/value']), 0)",
            0
          ]
        }
      ]
    },
    "type": "If"
  }
}
 
Categories:
I have the same question (0)
  • Srini007 Profile Picture
    3,327 Super User 2025 Season 2 on at
    Hi @EmmaX,
     
    As you have used Get Items action, that will output an array of Items for you. So to create the Items you have to use a Apply to each and inside that you can keep Create Item. As of now you are trying to keep the condition and inside you are trying to keep the array of the items which is not valid case. check as below
     
     
    In this case you don't need to check whether Get Items returns the Items or not, If Get Items returns no records then Apply to each will not run so it will not create any Items
     

    (If you got your solution you can mark as Answered and give it a Like)

    Regards,
    Srini

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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard