Nested for each loop created while copying outlook attachment to Azure Blob Storage

Ram Sekhar Grandhi 0 Reputation points
2024-05-06T18:07:16.3833333+00:00

I am creating one logic app and integrating with outlook mail account and Azure blob storage. When I am selecting blob name as dynamically Attachment Name then two loop is creating automatically, for each 1 and for each (Before few months, there was only one for-each getting created).

enter image description here

After that when I am sending mail, during triggering I am getting below error:

InvalidTemplate

Unable to process template language expressions for action 'For_each_1' at line '0' and column '0': 'The template language expression 'triggerBody()['value']' cannot be evaluated because property 'value' doesn't exist, available properties are 'Id, DateTimeReceived, HasAttachment, InternetMessageId, Subject, BodyPreview, Importance, ConversationId, IsRead, IsHtml, Body, From, To, Cc, Bcc, ReplyTo, Attachments'. Please see https://aka.ms/logicexpressions for usage details.'.

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,996 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Aki Nishikawa 1,560 Reputation points Microsoft Employee
    2024-05-07T05:50:30.61+00:00

    Hello Ram Sekhar Grandhi,

    I'm not sure the reason why two loops are specified even if Outlook connector de-batches bunch of mails. Anyway, there are following workarounds as of now.

    (1) If you accept sequential processing of mails, could you please disable "Split On" property? Even when two loops exist, the flow should work. User's image

    (2) If you like to process mails in parallel, could you please remove the outer loop? And for_each parameter should be changed from @item()?['Attachments'] to @triggerBody()?['Attachments'] because this flow processes each mail. User's image

    Also, appropriate "Split-On Tracking ID" is helpful for tracking each de-batched instance. Here is an example, where "id" in each mail is used as "Split-On Tracking ID". This is an optional configuration, so the flow works even if you leave Split-On Tracking ID brank. User's image

    0 comments No comments