Hello,
I'm quite new to Power Automate, so I apologize if I'm not giving all of the information needed here.
I'm creating a flow that reads the contents of a form after it's been modified, and copies it to the required subfolder based on the contents. The flow then replaces the blank form by copying it from a master file. For some reason the final step in the flow (SharePoint - Create file) is triggering the flow to repeat itself with the newly created form, even though the trigger says that it shouldn't be triggered by a file's initial creation.
Is this a known bug/issue and is there a workaround? Is there something I should be doing differently?
I'm attaching pictures of my trigger and my final steps for reference.
Solved! Go to Solution.
Like I said in my first response, I think the simplest way to conclude this is a work around, not a fix. But it will permanently mean it's not something you'll have to worry about in the future.
Add the hidden boolean column, and have the flow only run if the value is set to a certain value. Again, I'm not going to get into the weeds of that (others may want to) but it's the oldest fix in the book for this when using the old New/Modified trigger. You just need to be aware of all processes around this library when plotting it out.
A follow-up for anyone doing something similar. I've added a trigger condition that causes the flow not to run if it was modified by me (who the flow is operating as). This seems to work quite well! See the trigger condition below.
@not(equals(triggerOutputs()?['body/Editor/DisplayName'], '{Enter Display Name Here Without Brackets}'))
Without getting into to much depth on this, @JosephAM, this is because it's making a file in the same folder that's being monitored (unless you have trigger conditions you've not mentioned).
If you didn't have that folder there it could be worse, mind.
All the same, I think by far the easiest thing you can do here is create a hidden boolean (yes/no) column in the library, and then set a Trigger Condition to check that the yes/no is whatever value you need it to be in order for the flow to run.
The trick will come with managing how that field is controlled down the line of the business process, here.
I really think we probably need a bit more information about what's happening, though. Could you show your full flow as it it right now (edit screen), and also how you envisage this process working, because I'm entirely clear on it from the above? (apologies)
EDIT - Good spot from @MarconettiMarco there ... I've not actually even seen this particular action, so it's an interesting one, as I'd assumed it was the old "new/modified" one.
Hello @JosephAM ,
I performed the same actions and the flow isn't newly triggered:
Are you sure that you're not updating the original file in same Actions in the middle?
BR,
Marco
Could this be a factor of it possibly using the same name? I'd still assume that the SharePoint API wouldn't fire on this, but it could be that.
Hello @eliotcole ,
I hope no 😁.
Anyhow, if @JosephAM would share the entire flow in edit mode, we could better help him.
BR,
Marco
Sorry for the late response. I'm attaching the full process here. I don't believe the file is being modified by the script at any point before its deletion.
Missing from these images is the 'if no' section of the first condition, which is just blank. Also I've not put all of the parallel branches at the end, as they're identical to the last two images, aside from the folder name that the files are being created in.
This script isn't quite finished, as I'm still going to be setting up the substrings to be able to take variable length input.
Thank you both for your help!
Edit:
@MarconettiMarco @eliotcole, just to explain what's happening in this script, if it's not clear, I'm having the file be copied to a OneDrive folder so that I can create a .jpg copy. It needs to be a .jpg for the OCR to work. After extracting the text from that .jpg I delete those files that were created in OneDrive. Then that text is used to both determine where the file needs to go and what it's name should be.
Is that first condition to decide whether or not to continue, @JosephAM?
As you can make that a trigger condition by tapping the three dot menu on your trigger, and placing this in a Trigger Condition box:
|
|
|
I can't remember which of those is right, so you might want to test it out in a fresh flow with a Compose after the trigger to gather the above value(s), then run a test.
With one of those (or something like them) the flow will not run unless that field has that value.
The file that's created in the end has the same name as the file that was initially edited to kick off the trigger, so will this actually stop anything from running?
That being said, I didn't realize that trigger conditions were a thing! Thank you for introducing me to that. I'll experiment with what you've posted.
Could you elaborate on the 'Compose' bit? I'm not sure what that entails or how to implement it. Sorry for what I'm sure is a rookie question!
It's OK ... all of us are just scrambling around in the dark really, @JosephAM 😅 ... a 'Compose' action is one that you select from the 'Built-in' group of connectors in Power Automate, and it's listed under 'Data Operation'.
Compose actions are quite malleable, and can be used for a number of things, I usually use them for testing stuff out, seeing which bits and bobs give me what values, or just writing notes!
Well I'm definitely pretty deep in the dark here, haha! 😂
I tested each of the trigger conditions that you posted and experienced the following results:
@equals(triggerOutputs()?['body/{Name}'], 'Load Check Sheet - Inbound.pdf')
This resulted in the following error when trying to save the flow:
@equals(triggerOutputs()?['headers/x-ms-file-name'], 'Load Check Sheet - Inbound.pdf')
I was able to save the flow with this condition, however when editing the file the flow was never triggered.
@equals(triggerBody('FileLeafRef'), 'Load Check Sheet - Inbound.pdf')
When using this condition, the flow would begin, but immediately fail with the following error:
As for the Compose action, I'm not sure what to enter into the input field. Would it be the same strings that you posted above that I'm putting into the trigger condition field?
Thanks for your help, again!
OK, sorry, that's my fault.
Remove all those conditions, and just have the Compose there, and inside that, find the filename field that represents what you want, and then show me/us what is output when a file is modified.
No worries! Below you'll find the output.
Initial script run:
Second (unintentional) script run that gets triggered:
Compose Input:
Thanks!
EDIT - I'll also note that the second run fails at the step where it's searching for text (due to the form being blank), which is why this doesn't occur endlessly. @eliotcole
So, using the examples you've just provided, what I did here was to use the 'Peek code' to see what that triggerOutput would looklike to match on that:
|
Then I copied the relevant part:
|
Then I wrote this expression to put in my trigger condition, and it *only* fired when that field was capybara2.jpg, or was changed to capybara2.jpg:
|
This is great information, and I've now implemented this.
However, the file name with extension that is created at the end of the script is identical to the one that is looked for by the trigger condition, and somehow creating that file at the end seems to be setting off the trigger of the script again. Adding this condition to the trigger doesn't resolve this issue, since that file name is identical.
Do you have any other ideas of what could be causing this issue?
In the meantime I may try to recreate this script from scratch just to see if it continues to exhibit the same behavior.
Thanks!
EDIT - I've recreated the flow from scratch, using the trigger condition rather than the condition action, and it's still exhibiting the same issue, where the flow is triggered again by the file created at the completion of the initial run.
@eliotcole @MarconettiMarco
Any ideas where to go from here?
Troubleshooting Update: I attempted this just for my own sanity's sake, but figured one of you might find the information helpful. if I edit the flow to create the final file with a different name than the initial file that's used to trigger the script, then the flow does not run a second time.
I assume that this means that if a file is edited to trigger the script, then that file is deleted and recreated to restore it to it's original condition all in a single flow, Power Automate/SharePoint's API treats that as if it's the file being modified rather than a new file being created.
Does that seem to be the case to you all as well?
EDIT - Just to add to the troubleshooting update, manually deleting and recreating the file with the name that is set in the trigger condition does not cause the flow to start. So it's only when the file is created by the script that this happens.
Like I said in my first response, I think the simplest way to conclude this is a work around, not a fix. But it will permanently mean it's not something you'll have to worry about in the future.
Add the hidden boolean column, and have the flow only run if the value is set to a certain value. Again, I'm not going to get into the weeds of that (others may want to) but it's the oldest fix in the book for this when using the old New/Modified trigger. You just need to be aware of all processes around this library when plotting it out.
My goal is to try to make this as automated as possible, with staff not having to have any extra steps, like changing that column value so that the script can run.
I've opted to just move the file creation part to a second flow with a trigger that's searching for the deletion of the file from the first flow. It seems to be working as intended now.
Thank you for all of your help @eliotcole! Learning about trigger conditions and Compose has already simplified my life greatly. Hope you have a wonderful weekend!
EDIT - For anyone referencing this in the future, I was incorrect. Separating the file creation into a second flow does not fix the issue. I'll mark @eliotcole's boolean idea as the solution, as I can not think of a better one!
A follow-up for anyone doing something similar. I've added a trigger condition that causes the flow not to run if it was modified by me (who the flow is operating as). This seems to work quite well! See the trigger condition below.
@not(equals(triggerOutputs()?['body/Editor/DisplayName'], '{Enter Display Name Here Without Brackets}'))
Dear Community Members, We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd. During this period, members will not be able to Kudo, Comment, or Reply to any posts. On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities. What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!
We are excited to announce the Summer of Solutions Challenge! This challenge is kicking off on Monday, June 17th and will run for (4) weeks. The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities. Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”) - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024 Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods. You must enter into each weekly Entry Period separately. How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different. Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers. At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing. Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner. A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random. Individuals will be contacted before the announcement with the opportunity to claim or deny the prize. Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners. Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event. ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE** Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24 17 @Anil_g 7 @ManishSolanki 13 @eetuRobo 5 @David_MA 10 @VishnuReddy1997 5 @SpongYe 9JhonatanOB19932 (tie) @Nived_Nambiar 8 @maltie 2 (tie) @PA-Noob 2 (tie) @LukeMcG 2 (tie) @tgut03 2 (tie) Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate @Deenuji 12@ManishSolanki 19 @Anil_g 10 @NathanAlvares24 17 @VishnuReddy1997 6 @Expiscornovus 10 @Tjan 5 @Nived_Nambiar 10 @eetuRobo 3 @SudeepGhatakNZ 8 Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22 Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2 Anil_g2 SharonS2
On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners. The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights. Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.
We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for. We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer. Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together. Here's to new beginnings and endless possibilities! If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport. To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages