We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A foreach loop goes through all items in an array. For each item a variable is set in the iteration and used in a HTTP request. Here is the setup:
As you can see the connectionIdentifier variable is set first and then used within the condition block.
However in practise what I see is that the variable value of the previous iteration is used when processing the second item in the array.
Am I doing something wrong here? What did the reference get the value of the previous iteration?
Some more testing I did:
consumption
{ "definition": { "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", "actions": { "For_each": { "actions": { "Set_userName_value": { "inputs": { "name": "userName", "value": "@{item()?['name']}" }, "runAfter": {}, "type": "SetVariable" }, "Show_userName_value": { "inputs": "@variables('userName')", "runAfter": { "Set_userName_value": [ "Succeeded" ] }, "type": "Compose" } }, "foreach": "@variables('UserArray')", "runAfter": { "Initialize_UserArray_variable": [ "Succeeded" ] }, "type": "Foreach" }, "Initialize_UserArray_variable": { "inputs": { "variables": [ { "name": "UserArray", "type": "array", "value": [ { "name": "Alice", "number": "46374" }, { "name": "Bob", "number": "65378" }, { "name": "John", "number": "22654" } ] } ] }, "runAfter": { "Initialize_userName_variable": [ "Succeeded" ] }, "type": "InitializeVariable" }, "Initialize_userName_variable": { "inputs": { "variables": [ { "name": "userName", "type": "string" } ] }, "runAfter": {}, "type": "InitializeVariable" } }, "contentVersion": "1.0.0.0", "outputs": {}, "parameters": {}, "triggers": { "manual": { "inputs": {}, "kind": "Http", "operationOptions": "IncludeAuthorizationHeadersInOutputs", "type": "Request" } } }, "parameters": {} }
No response
This is ONLY affecting the foreach loop. The do until loop respects the variable value correctly.
AB#24543921
The text was updated successfully, but these errors were encountered:
Hi @brolifen, I saw you closed the issue, are you still able to reproduce it or did you reach some sort of resolution?
Sorry, something went wrong.
try to use it in sequential mode
https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-control-flow-loops?tabs=consumption#for-each-run-sequentially
No branches or pull requests
Describe the Bug
A foreach loop goes through all items in an array. For each item a variable is set in the iteration and used in a HTTP request. Here is the setup:
As you can see the connectionIdentifier variable is set first and then used within the condition block.
However in practise what I see is that the variable value of the previous iteration is used when processing the second item in the array.
Am I doing something wrong here? What did the reference get the value of the previous iteration?
Some more testing I did:
Plan Type
consumption
Steps to Reproduce the Bug or Issue
Workflow JSON
Screenshots or Videos
No response
Additional context
This is ONLY affecting the foreach loop. The do until loop respects the variable value correctly.
AB#24543921
The text was updated successfully, but these errors were encountered: