Search code examples
azure-logic-appsazure-form-recognizer

In logic app , pass only 1 email attachment to Form Recognizer API


Im trying to analyse the 1 attachment per email, using Logic App and Forn Recognmizer API but it's creating a "For Each Loop" as it could be more than 1 attachment per email. How can I limit to 1 and ditch the loop ?

Thanks David


Solution

  • You need to use an expression to set a variable (or the like) to single out the attachment.

    This is the expression I used to set a variable of type Object ...

    first(triggerOutputs()?['body/attachments'])
    

    This is the result ...

    Result

    ... that will avoid looping. You'll just need to do the work to get the relevant property value (likely contentBytes) into the form recognizer operation.