cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

When new Version is created

I want a flow which will run only when any new version of document is created in One drive for business. Can anyone help in creating this flow

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @jitendrasingh,

 

It looks like it is the same error as from the previous screenshots. Like we established together the etag field is absent from your trigger outputs. So, it is trying to split on a field which isn't available yet, because the response is a HTTP 202 and not a HTTP 200 with the metadata.

 

Can you try the expression below. I have slightly adjusted it to handle the scenario where it is empty. Can you test and see if that can handle the HTTP 202 response (which doesn't have an etag yet):

@greaterOrEquals(replace(split(if(empty(triggerOutputs()?['headers/x-ms-file-etag']), '0,0', triggerOutputs()?['headers/x-ms-file-etag']), ',')[1], '"', ''), '3')

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

20 REPLIES 20
Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @jitendrasingh,

 

As far as I am aware every modification to a file in OneDrive for Business will result in a new major version of the file.

 

So, it should be sufficient to use the When a file is modified (properties only) trigger action in your flow:

https://docs.microsoft.com/en-us/connectors/onedriveforbusiness/#when-a-file-is-modified-(properties...

 

Hope this helps a bit?



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Hi @Expiscornovus 

 the flow you mentioned  triggers action on when file is created as well as when file is modified (New Version). I need a flow which will trigger only when file is modified and not when file is created.

Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @jitendrasingh,

 

Are you sure? Isn't it just the 2.0 version of the newly created file (which is a modification?) As far as I am aware that action only triggers when a file is modified.

 

For the create event Microsoft has a different trigger action called:

https://docs.microsoft.com/en-us/connectors/onedriveforbusiness/#when-a-file-is-created-(properties-...

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Hi @Expiscornovus 

 

Yes I am sure.. I tested many times... It not only triggers for modification (version 2.0 or later) of file but also for creation of file .. You can test the same 

Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @jitendrasingh,

 

I also tried reproducing this and I am unable to. For me it only triggers when modifying the file, starting from the 2.0 version of a file.

 

Can you share some screenshots of your setup and your flow history. Let me see if I can reproduce it with your setup.



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Hi @Expiscornovus 

I create similar flow but again it triggered when i created a file in it. Please find below snapshots of same

jitendrasingh_0-1619162692936.png

jitendrasingh_1-1619162771040.png

 

 

Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @jitendrasingh,

 

Thanks for sharing your setup. Looks pretty similar to mine. 

 

Another validation question. How are you testing? Are you uploading a file or are you creating it via the new button?

newfile_orupload.png

 

And if you are using the second testing scenario are you renaming the file?

 

I was doing the same thing in my tests and also triggered the flow. Because the renaming action will create a second version of the file, which makes it seem like it is triggering for a newly created file.

 

versionhistoryoffile.png

 

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Hi @Expiscornovus 

I am uploading the file with same name & it is updated as new version.

The flow triggers when new file is uploaded as well as when new version of same file is uploaded.

I want flow to run only when new version is uploaded (Version 2.0 onwards) and not on Version 1.0 

 

Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @jitendrasingh,

 

Thanks for sharing. With an upload I am also able to reproduce this behaviour.

 

I think we can use the Etag and use the second part of that to retrieve at the version. We can use a greaterorequals to make sure it is at least 2.0.

 

Can you add the following expression as a trigger condition to your action?

@greaterOrEquals(replace(split(triggerOutputs()?['body/ETag'], ',')[1], '"', ''), '2')

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Hi @Expiscornovus 

Thanks... I am new to Power automate,Can you share screenshot of the solution you suggested so that i can reproduce same in my environment

Hi @Expiscornovus 

I have added above expression in my trigger however it is showing flow error .Screenshot attached

jitendrasingh_0-1619416329931.png

 

 

 

Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @jitendrasingh,

 

I noticed in your last screenshot that you are using a different trigger action compared to my example. I was using the When a file is modified (properties only) one in my example.

 

etag_differenttriggeraction.png

 

The trigger outputs of the When a file is modified action you are using is slightly different. 

 

If you want to keep using the modified action you need to use a different field from the trigger action in the expression, the field entity tag.

 

In that case the expression would be:

 

@greaterOrEquals(replace(split(triggerOutputs()?['headers/x-ms-file-etag'], ',')[1], '"', ''), '3')

 

 

The trigger condition can be added via the settings of my When a file is modified action. Below is a screenshot of that.

 

whenfileismodified_fileentitytag.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Hi @Expiscornovus 

 

I have used the trigger as suggested above however while saving the flow it is showing an error as Invalid Template with the following error

The template language function 'split' expects its first parameter to be of type string."

Hi @Expiscornovus 

I have used the trigger as suggested above however while saving the flow it is showing an error as Invalid Template with the following error

The template language function 'split' expects its first parameter to be of type string."Screenshot of same is shared below

jitendrasingh_0-1619509781622.png

Please help

 

 

Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @jitendrasingh,

 

In your screenshot I see a flow run and some headers. I am interested to see what's in those trigger outputs headers. Can you click the show raw outputs link and copy/paste or screenshot that?

 

Below is an example of the headers I would be expecting for a When a file is modified trigger action.

triggerheadersoutput.png

 

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Hi @Expiscornovus 

jitendrasingh_3-1619519780556.png

 


 


 


 

Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @jitendrasingh,

 

I see you are getting an HTTP 202 instead of a HTTP 200. So, it looks like it was still processing the upload when the flow was triggered and this is the reason why it can't find the metadata of your file.

https://blog.encodian.com/2020/03/202-status-code-and-asynchronous-pattern-power-automate/

 

Out of interest, what kind of files (type and size) are you using in your tests when uploading?

 

 

I see your trigger action



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Hi @Expiscornovus 

 

Actually the flow is showing following error after adding trigger action suggested by you

jitendrasingh_0-1619522081629.png

The details of error on follow up screen is pasted below

jitendrasingh_1-1619522357127.png

As the flow is being saved with errors so there are no triggers with file being uploaded.

 

Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @jitendrasingh,

 

It looks like it is the same error as from the previous screenshots. Like we established together the etag field is absent from your trigger outputs. So, it is trying to split on a field which isn't available yet, because the response is a HTTP 202 and not a HTTP 200 with the metadata.

 

Can you try the expression below. I have slightly adjusted it to handle the scenario where it is empty. Can you test and see if that can handle the HTTP 202 response (which doesn't have an etag yet):

@greaterOrEquals(replace(split(if(empty(triggerOutputs()?['headers/x-ms-file-etag']), '0,0', triggerOutputs()?['headers/x-ms-file-etag']), ',')[1], '"', ''), '3')

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

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!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

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  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

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.    

Updates to Transitions in the Power Platform Communities

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

Users online (1,844)