Skip to content
New issue

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

Node values are not properly recognized in nested ForEach loops #6248

Open
PedroAlmeidaMS opened this issue Dec 11, 2024 · 1 comment
Open
Assignees

Comments

@PedroAlmeidaMS
Copy link

PedroAlmeidaMS commented Dec 11, 2024

Describe the Bug with repro steps

  1. create workflow
  2. have actions that return arrays
  3. create nested foreach loops
  4. attempt to retrieve information from the actions

What type of Logic App Is this happening in?

Standard (Portal)

Which operating system are you using?

Windows

Did you refer to the TSG before filing this issue? https://aka.ms/lauxtsg

Yes

Workflow JSON

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "Initialize_variable": {
                "type": "InitializeVariable",
                "inputs": {
                    "variables": [
                        {
                            "name": "jsontest",
                            "type": "string"
                        }
                    ]
                },
                "runAfter": {}
            },
            "For_each_contact": {
                "type": "foreach",
                "foreach": "@body('List_rows_-_contacts')?['value']",
                "actions": {
                    "For_each_account": {
                        "type": "foreach",
                        "foreach": "@body('List_rows_-_accounts')?['value']",
                        "actions": {
                            "Set_variable": {
                                "type": "SetVariable",
                                "inputs": {
                                    "name": "jsontest",
                                    "value": "{\n\"accountValue\": @{item()?['name']},\n\"emailAddressValue\" @{item()?['emailaddress1']}: \n}"
                                }
                            }
                        }
                    }
                },
                "runAfter": {
                    "List_rows_-_contacts": [
                        "SUCCEEDED"
                    ]
                }
            },
            "List_rows_-_accounts": {
                "type": "ApiConnection",
                "inputs": {
                    "host": {
                        "connection": {
                            "referenceName": "commondataservice-1"
                        }
                    },
                    "method": "get",
                    "headers": {
                        "prefer": "odata.include-annotations=*",
                        "accept": "application/json;odata.metadata=full",
                        "organization": "@{encodeURIComponent(encodeURIComponent('DATAVERSE ORG'))}"
                    },
                    "path": "/api/data/v9.1/@{encodeURIComponent(encodeURIComponent('accounts'))}",
                    "retryPolicy": {
                        "type": "none"
                    }
                },
                "runAfter": {
                    "Initialize_variable": [
                        "SUCCEEDED"
                    ]
                },
                "operationOptions": "DisableAsyncPattern"
            },
            "List_rows_-_contacts": {
                "type": "ApiConnection",
                "inputs": {
                    "host": {
                        "connection": {
                            "referenceName": "commondataservice"
                        }
                    },
                    "method": "get",
                    "headers": {
                        "prefer": "odata.include-annotations=*",
                        "accept": "application/json;odata.metadata=full",
                        "organization": "@{encodeURIComponent(encodeURIComponent('DATAVERSE ORG'))}"
                    },
                    "path": "/api/data/v9.1/@{encodeURIComponent(encodeURIComponent('contacts'))}",
                    "retryPolicy": {
                        "type": "none"
                    }
                },
                "runAfter": {
                    "List_rows_-_accounts": [
                        "SUCCEEDED"
                    ]
                },
                "operationOptions": "DisableAsyncPattern"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "triggers": {
            "When_a_HTTP_request_is_received": {
                "type": "Request",
                "kind": "Http"
            }
        }
    },
    "kind": "Stateful"
}

Screenshots or Videos

values of the actions is being returned as item and should refer to the loop:

\n"accountValue": @{item()?['name']},\n"emailAddressValue" @{item()?['emailaddress1']}: \n}"

should be

\n"accountValue": @{items('For_each_account')?['name']},\n"emailAddressValue" @{items('For_each_contact')?['emailaddress1']}: \n}"

Image

Image

The action lists the fields correctly, but we can't set the value properly, it's not recognizing the loop context.

Browser

Edge

Additional context

No response

@takyyon
Copy link
Contributor

takyyon commented Dec 11, 2024

Assigning this to Eric as well as he looks into the other nested foreach issue #6239

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants