Context: Desk Flow (not Cloud Flow)
Goal: Get a SharePoint List and iterate through the list doing some action
Pseudo Code:
- 'Get items' -> output variable SPListQueued
- 'For Each' CurrentSPItem in SPListQueued.value
- If CurrentSPItem.E1 is not blank ...
Problem: When SharePoint item's E1 column is blank, the 3rd line gets an error "Property E1 does not exist in CurrentSPItem" .
The flow works well when an item does have a value in 'E1' column. This means the set of properties of the loop variable (CurrentSPItem) is different every time, depending on whether the original SharePoint List item had values in the fields or not. This is ridiculous. How do I write code inside the loop when a loop variable has different properties set every time? I asked Github Copilot this question. This was a its response:
"In Power Automate Desktop, the behavior you described where a column with blank values results in the absence of the property in the variable receiving items is indeed a known behavior. This can be challenging to handle, especially when you expect all properties to be present regardless of whether they have values or not.
To handle this situation, you can use a combination of actions to check for the existence of the property and assign a default value if it is missing. Here is a step-by-step approach to handle missing properties:
1. Get Items from SharePoint List:
2. Loop Through Each Item:
3. Check for Missing Property:
• Use an "If" condition to check if the property exists.
• If the property does not exist, set a default value."
I sighed but kept trying to overcome this limitation, following Copilot's recommendation. But soon I realized the Desk Flown Designer did not have any way to check whether a variable's property exist or not (IsBlank() did not work if you wondered). So frustrating. How do you guys work around this?