Azure / LogicAppsUX

https://learn.microsoft.com/azure/logic-apps
MIT License
75 stars 81 forks source link

Working with attachments always adds a 2 level nested foreach loop to the workflow. #3086

Open kokernutz opened 1 year ago

kokernutz commented 1 year ago

Describe the Bug with repro steps

  1. Add a trigger of "When a New Email Arrives."
  2. Add an action of "create blob".
  3. Select attachment name from the email step.

At this point a two nested foreach loops appear, and it doesn't work as I expect.

This doesn't happen in any tutor that I've watched about this.

I've tried the legacy designer and it does something similar.

What type of Logic App Is this happening in?

Standard (Portal)

Are you using new designer or old designer

New Designer

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": {
      "For_each_1": {
        "type": "foreach",
        "foreach": "@triggerBody()?['value']",
        "actions": {
          "For_each": {
            "type": "foreach",
            "foreach": "@item()?['attachments']",
            "actions": {
              "Create_blob_(V2)": {
                "type": "ApiConnection",
                "inputs": {
                  "host": {
                    "connection": {
                      "referenceName": "azureblob-2"
                    }
                  },
                  "method": "post",
                  "body": "@base64ToBinary(items('For_each')?['contentBytes'])",
                  "headers": {
                    "ReadFileMetadataFromServer": true
                  },
                  "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/files",
                  "queries": {
                    "folderPath": "/peopledoc-overdue-attestations",
                    "name": "@items('For_each')?['name']",
                    "queryParametersSingleEncoded": true
                  }
                },
                "runtimeConfiguration": {
                  "contentTransfer": {
                    "transferMode": "Chunked"
                  }
                }
              }
            }
          }
        },
        "runAfter": {}
      }
    },
    "contentVersion": "1.0.0.0",
    "outputs": {},
    "triggers": {
      "When_a_new_email_arrives_(V3)": {
        "type": "ApiConnectionNotification",
        "inputs": {
          "host": {
            "connection": {
              "referenceName": "office365"
            }
          },
          "fetch": {
            "pathTemplate": {
              "template": "/v3/Mail/OnNewEmail"
            },
            "method": "get",
            "queries": {
              "importance": "Any",
              "fetchOnlyWithAttachment": true,
              "includeAttachments": true,
              "subjectFilter": "Sandbox Takeda Training",
              "folderPath": "Inbox"
            }
          },
          "subscribe": {
            "body": {
              "NotificationUrl": "@{listCallbackUrl()}"
            },
            "pathTemplate": {
              "template": "/GraphMailSubscriptionPoke/$subscriptions"
            },
            "method": "post",
            "queries": {
              "importance": "Any",
              "fetchOnlyWithAttachment": true,
              "folderPath": "Inbox"
            }
          }
        },
        "conditions": []
      }
    }
  },
  "connectionReferences": {
    "office365": {
      "connection": {
        "id": "/subscriptions/0fde68c2-dc9c-4acd-b13c-fd0d9b63ee9b/resourceGroups/hr-technology/providers/Microsoft.Web/connections/office365"
      },
      "connectionName": "office365",
      "api": {
        "id": "/subscriptions/0fde68c2-dc9c-4acd-b13c-fd0d9b63ee9b/providers/Microsoft.Web/locations/eastus/managedApis/office365"
      },
      "authentication": {
        "type": "ManagedServiceIdentity"
      }
    },
    "azureblob-2": {
      "connection": {
        "id": "/subscriptions/0fde68c2-dc9c-4acd-b13c-fd0d9b63ee9b/resourceGroups/hr-technology/providers/Microsoft.Web/connections/azureblob-6"
      },
      "connectionName": "azureblob-6",
      "api": {
        "id": "/subscriptions/0fde68c2-dc9c-4acd-b13c-fd0d9b63ee9b/providers/Microsoft.Web/locations/eastus/managedApis/azureblob"
      },
      "authentication": {
        "type": "ManagedServiceIdentity"
      }
    }
  },
  "parameters": {}
}

Screenshots or Videos

No response

Browser

Edge

Additional context

No response

AB#24750928

rllyy97 commented 1 year ago

@kokernutz Thank you for letting us know about this! I'll be taking a look into it and let you know of any updates

azure-boards[bot] commented 8 months ago

❌ There was a problem linking to Azure Boards work item(s):

Please check the IDs and try again using the AB# syntax. Learn more

azure-boards[bot] commented 8 months ago

❌ There was a problem linking to Azure Boards work item(s):

Please check the IDs and try again using the AB# syntax. Learn more

azure-boards[bot] commented 8 months ago

❌ There was a problem linking to Azure Boards work item(s):

Please check the IDs and try again using the AB# syntax. Learn more

azure-boards[bot] commented 8 months ago

❌ There was a problem linking to Azure Boards work item(s):

Please check the IDs and try again using the AB# syntax. Learn more