cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
donAlto
Frequent Visitor

Get Items is Null causing For Each to do nothing

Hi All,

I have a dilemma.

My flow checks a library to see what the last used identifier is, and increment it by one for the next created document.

However, in testing, my Get Items returns a null when I first run the workflow because there are no items YET in the library for it to query. So the Get Items returns a null value and therefore the subsequence For Each does nothing because there are no items for it to loop on.

 

I must be missing something simple here. I tried a condition in between the Get Items and the For Each which said 

If value (from Get Items) is null, then skip the For Each, but this condition never seems to get satisfied.

When I check the value in the Get Items body, i see:

 

{
"value": []
}
 
Any help appreciated.
1 ACCEPTED SOLUTION

Accepted Solutions
yashag2255
Dual Super User II
Dual Super User II

Hey @donAlto 

 

The foreach in the get items is basically to iterate over all the items returned and perform the actions in the loop. If you want to check the returned list is empty: eee3.PNG

 

But if the list is empty the flow will not go to the apply to each at all so no point adding that condition. Can you share more details on the scenario you are trying to build and we mitght be able to better assist you with this. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

3 REPLIES 3
yashag2255
Dual Super User II
Dual Super User II

Hey @donAlto 

 

The foreach in the get items is basically to iterate over all the items returned and perform the actions in the loop. If you want to check the returned list is empty: eee3.PNG

 

But if the list is empty the flow will not go to the apply to each at all so no point adding that condition. Can you share more details on the scenario you are trying to build and we mitght be able to better assist you with this. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

RezaDorrani
Dual Super User II
Dual Super User II

Hi @donAlto 

 

Even if the for loop does not do anything since it has no items to run on - the Flow will continue after the for loop (see screenshot below)

 

Capture1.PNG

So whatever logic you have within for loop will not run unless there is data returned in get items 

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

@yashag2255 

Thank you, you are a saviour!

This approach worked much better than evaluating the null, thanks for the idea! 🙂

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (27,550)