Power Automate Exchange

Please login or click SIGN UP FOR FREE to create your FlowUG account to join this user group.
 View Only
  • 1.  'When a file is created (properties only)' trigger firing multiple times

    Posted 7 days ago
    I'm having an issue with several flows firing twice on file creation.  I'm using the on-premise gateway, and looking for a file to be created in a specific folder located on a local network NAS. Both executions fire within a few seconds of each other. If I look at the details for the first execution (screenshot marked '1' below), the body response is empty. On the second execution (screenshot marked '2' below), I see the expected file details appear. Any suggestions on what to try, as I've exhausted my google searches?

    Here's what happens when I copy and paste a .txt file into the folder being monitored - '1' is first execution with seemingly no file, and '2' is the second execution with the file as expected.  I can set up an exit condition if the trigger body is empty, but would rather fix the root cause if possible.



    The file is not modified by the flow - only deleted - and the first execution actually skips this logic as there is no file to process:



    Here's the trigger - not much for me to muck up here:


    Things I've tried:
    1) Changing the trigger to a new folder 'SanityCheck' that I know no other flows are using.
    2) Deleting and re-creating the trigger action
    3) Googling until my fingers bleed...




    ------------------------------
    Jeff Woodard
    Chief Technical Officer
    Transportation Financial Services, Inc.
    West Palm Beach FL
    (561) 832-3110
    ------------------------------


  • 2.  RE: 'When a file is created (properties only)' trigger firing multiple times

    Top Contributor
    Posted 6 days ago
    Some times these flow triggers are so quirky, the only option is to account for these scenarios with other controls, not ideal but saves the tips of your fingers for more important work. I just replicated something similar on my side (when a file is created on a server that requires the on-prem gateway). I'll see what that does. But based on what you are seeing it looks like the file is created in two parts. The shell is created, and the content is added after that, it could be a test (from the file system not flow) perhaps to see if the file exists before it attempts to create a file that has a name conflict. So flow is seeing the "temp" file created and then the actual file being created after that.

    What I've done in these scenarios where a flow will trigger more often than it will actually run is use the HTTP action and split the flow in two parts. Part one has the trigger and is my "polling query" it runs and detects the presence of a file and like you mentioned a condition action tests to see if it is the file I want. If it is, it runs the HTTP action and passes some details I need to the second flow.

    Part Two has the receiving http trigger, that accepts the parameters from Part One and proceeds with the rest of the workflow. This helps when having to look back at a specific run, Way oversimplified I know but, say a week later when a single file dropped daily for 7 days, if it was all in one flow I would have to look at 14 different runs to find the one I was looking for instead of the 7 by splitting the two flows.

    ------------------------------
    Sam Duval
    Data Quality Analyst
    Element Financial
    Indianapolis IN
    ------------------------------



  • 3.  RE: 'When a file is created (properties only)' trigger firing multiple times

    Posted 3 days ago
    Thanks for the follow-up Sam - curious if you see the same behavior that I am?

    I re-wrote about 5 of these file creation flows in order to move them from stand-alone flows to solution-based, and am seeing pretty consistent behavior,  The drive I am currently monitoring is on a NAS device, so there may indeed be some intricacies related to the file creation. I may test  on some different storage mediums to see if there is any difference. I was thinking it may be potentially related to malware scan, or backup system file tagging. Our volumes are not very critical now, but this could make a huge difference when billed by execution.  I like your polling query suggestion; in our case we look at several different folders, so not sure that it would simplify our logic that much, but will keep that pattern in my back pocket if it presents itself somewhere else.

    For now, I've used a pattern just after the trigger, like below, that exits immediately if there is no file to process. With the termination status of cancelled, I don't artificially trigger a failure notification, and it makes it a bit easier to browse the history after the fact.



    ------------------------------
    Jeff Woodard
    Chief Technical Officer
    Transportation Financial Services, Inc.
    West Palm Beach FL
    (561) 832-3110
    ------------------------------



  • 4.  RE: 'When a file is created (properties only)' trigger firing multiple times

    Top Contributor
    Posted 5 hours ago
    @Jeff Woodard I am not experiencing the same as you, so I think that rules out the gateway as the culprit, and puts the spot light on the storage device. Out "on-prem" file system is actually an azure file share system, so that could be part of why I'm not seeing what you are seeing.​

    ------------------------------
    Sam Duval
    Data Quality Analyst
    Element Financial
    Indianapolis IN
    ------------------------------