Hi All, i hope you can help me, i have a sharepoint list containing records and another with criteria which to base an email flow, so if someone creates a record that has a certain reason code selected then an email is raised.
I have a field that has all the ids with a seperator. so i set an array variable to the field and then want to loop the array to check each id against the record, however when i hit the loop; flow is claiming it is empty, even though it clearly shows it is now empty, just incase youre wondering about the index reset stage, that is a different variable called index so im not clearing it myself! see below, thanks,
Hi @dionmills_argos,
Can you share the detailed configuration about this flow? I only see the errors but not what are those fields filled with. Also the column types that you are using in Flow.
Regards,
Mona
HI @v-monli-msft,
This flow loops through records on a sharepoint list so its as below:
initialise variables (array, index)
get a list of records
loop through records
{
Get Record
Get IDs String ('1;#;#2;#;#3;#;#')
Get IDs string into array variable split([IDs],';#;#') result is: ["1","2","3"]
Set Index variable to 1
Set count varible to length of array result is 3
Apply to all (array)
{
ARRAY IS EMPTY???
}
}
its worth noting that if i create a test flow with only the below (using just a static string to split) it is working
Get IDs string into array variable split('1;#;#2;#;#3;#;#,';#;#') result is: ["1","2","3"]
Set Index variable to 1
Set count varible to length of array result is 3
Apply to all (array)
{
ARRAY IS NOT EMPTY
}
hi!
Have you managed to work it out? I am facing the same issue, no matter if I pass an array to for each or if I turn my array into a JSON object.
Regards,
Tomasz
Hi @TPoszytek,
I did not, i really think its a bug, however i did make another flow that has a similar loop since then and even though it says the array is empty, the loop must have been performed because a variable i make in that loop ended up bveing populated so i think its really just a bug in showing what happened in that loop. Try setting a variable in that loop and then take an action on that variable after it to see if it has been populated. you may find that the loop did indeed run but it just says it didnt.
Hope this helps
One more thing - I found out that this behavior is caused by the nested for each loops. If I move my for each loop outside the other one, iterator works fine. However when it is inside the other loop, it claims that my array/ object is empty. How that can be solved?
Regards,
Tomasz
Hi @TPoszytek,
Yes i absolutely agree with you, nested foreach loops is where the issue occurs, i have tried setting the loops to sequantial and the web requests so syncronous but this did not help. It is a bug and needs to be fixed. i was able to alter my thinking about the way my flow works and built up a string query to get exactly the data i wanted from my web request so i only needed 1 loop.
But this clearly needs to be fixed.
And I had worked it out by calling a second flow out of the loop in my first flow, passing the data to it, so that it handles the operations that the second loop was intended to handle. It has to be a bug unfortunately.
Regards,
Tomasz
@dionmills_argos one last thing - the release notes claim, that the nested for each should already be released: https://docs.microsoft.com/en-us/flow/release-notes:
But it seems something still does not work ๐
Regards!
This is an important issue. The nested foreach feature was very needed but this does not work. I've searched in the json definition of the flow but I see nothing wrong. I checked runAfter property is set ok.
๐
Please fix!
Did they fix it?
I don't think so.
I can do "nested loops" calling to another flow and transforming the inner array in the first flow in an outer array in the second flow using http calls. BUT this implies A LOT of flow executions...
This is so hard to mantain if you have three nested arrays...
How is ComplianceReasons declared in your SP list? Is it a string-one line, string-multiple lines?
I had a "similar" problem with objects extracted from SP list, then sent to a second flow via HTTP, I could see them when inspecting Run History, but when I finally tried to access them, Flow considered them empty. No loops involved in my case, so it is not exactly the same scenario.
Thanx!
Proud to be a Flownaut!
It is declared as single line, then the array is initialised and the string is split by a delimiter into the array which is clearly populated as shown.
Hi,
I made a very simple example of the "array is empty" issue. First loop works well but second loop doesn't see the array values. ยฟAny ideas?
Thanks in advance
Flow definition
Flow execution
I just ran into this problem as well. I was very confused as to why my nested array appeared empty while looping over it until I read this post. Thank you for pointing it out, and I hope Microsoft is able to address this bug very soon.
Check out new user group experience and if you are a leader please create your group
See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.
User | Count |
---|---|
46 | |
10 | |
9 | |
8 | |
6 |
User | Count |
---|---|
67 | |
22 | |
12 | |
11 | |
11 |