I have a flow that runs once a week using a Recurrence. The Get Items connector for SharePoint filters the list based on the next weeks upcoming events. An email then is sent listing the upcoming events.
This has been working fine but now I would like to add a Condition so that when the Get Items Filter return Value: [] meaning no events for that week a different email is sent rather than my Flow just failing.
I can't figure out how to do this. I have tried a Condition where the value (List of Values) equals [ ], NULL, Blank, 0.
Solved! Go to Solution.
You can use the length() expression to check for no items being returned by get items. You'll find length() under the Collections heading.
In the example below, the variable will be set to zero if there are no items returned:
So, have a condition that checks for zero.
If this answers your question, please mark your post as Solved.
Scott
Thanks Scott that worked great and was easy to implement. I'm fairly new to Flow and the 'iniatilize variable' will come in handy.
You can initialize the variable near the top of your Flow and before the loop - do not set it to a value. Within the loop, use a Set Variable action and use the expression that I showed above to get the number of items.
You can use the length() expression to check for no items being returned by get items. You'll find length() under the Collections heading.
In the example below, the variable will be set to zero if there are no items returned:
So, have a condition that checks for zero.
If this answers your question, please mark your post as Solved.
Scott
Thanks Scott that worked great and was easy to implement. I'm fairly new to Flow and the 'iniatilize variable' will come in handy.
Hi Scott,
I have tried to use this solution in a flow I am building to create/update items in a SharePoint list.
The 'Get items' action is within a 'For each' container, and when I try to add the 'Initialise variables' action I get an error;
'The operation 'Initialise variable' can only be used at top level'.
Are there any other methods to achieving this?
Many thanks,
Lucy
You can initialize the variable near the top of your Flow and before the loop - do not set it to a value. Within the loop, use a Set Variable action and use the expression that I showed above to get the number of items.
Join digitally, March 2โ4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!
Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.
User | Count |
---|---|
90 | |
50 | |
36 | |
30 | |
27 |
User | Count |
---|---|
73 | |
60 | |
50 | |
39 | |
38 |