Skip to main content

Notifications

Power Automate - Using Flows
Answered

When new email arrives (V3) triggered flow to run twice instead of once

(0) ShareShare
ReportReport
Posted on by 13
Hello folks,
 
I'm encountering an issue where my flow is creating two new different rows in my Excel sheet when it should only create one new row. The flow is triggered by an email with one PDF attachment and should only run once daily. Interestingly, the two new rows contain different values.
 
**Flow Overview:**
1. Trigger: When a new email arrives (V3) with a PDF attachment and specific subject line
2. Delay: 1 minute
3. Process: Use AI Builder document processing to extract data from the PDF
4. Output: Insert a new row into an Excel sheet (stored in SharePoint)
 
**What I've Tried:**
1. Duplicated the flow and turn off the old flow - issue persists
2. Removed and reconnected all connections - issue persists
 
**Important Notes:**
- Manual test runs work correctly (creates single row as expected)
 
**Questions:**
1. Could the loop be causing this duplicate row issue?
2. Why would the rows contain different values?
 
Below are screeshots of my flow and also the parameters I've set for each steps. 
Any insights would be greatly appreciated!
 
 
 
 
 
 
 
 
  • Verified answer
    Mark Nanneman Profile Picture
    Mark Nanneman 976 on at
    When new email arrives (V3) triggered flow to run twice instead of once
    First, you don't need your delay in a loop.  I'd move it out of the loop directly under the trigger (if you need it at all)

    I'm assuming your loops are all taking the attachments array from the email as their input, if this is the case you don't need multiple loops, put everything inside one loop and delete the others.

    Again, assuming your loop is based on the attachments array on the email, the reason it contains more than one iteration and creates more than one row in your sheet is most likely because your email actually has additional attachments.  Frequently, an image that is embedded in the email has an associated hidden attachment.

    E.g. this email I sent myself from gmail has an embeded picture and a pdf attachment.  Only the PDF shows as an attachment in Outlook.

    But if I look at the output of the "when a new email arrives (v3)" in the flow run, I see two attachments.
    The "hidden" attachment is for the image file, and its "isInline" property is set to "true" because it's in the message body.



    Check your flows trigger outputs on recent runs.  If the additional attachment(s) are image files, I'm not sure why your Extract isn't failing.  Perhaps it's just returning nulls, blanks or junk data for the second attachment?

    The solution would be to filter your attachments from the email so that you're only running the PDFs. 

    You could do this with a condition in your loop.
    Something like  "item()?['name'] ends with 'pdf'"



    Or the best way would be to use a filter on the array and then loop on the output of this filter.





    If this helped you, please click "Does this answer your question" and give it a like to help others in the community (+ close the ticket)!

    Power Platform Developer | LinkedIn: Mark Nanneman | Blog: Power Stuff  | YouTube: Mark's Power Stuff  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,434

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,722

Leaderboard

Featured topics

Restore a deleted flow