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:
- Trigger: Manually trigger a flow.
- Action: List tasks from Planner.
- Action: Get items from a SharePoint list.
- 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.
- Condition: Check if the task title matches the item ID.
- Apply to each task in Planner:
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"
}
}

Report
All responses (
Answers (