cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Flow Based on Time & Date Modified being Greater than Created

Hi,

 

I'm trying to create a flow on OneDrive for Business where if a document is modified after it's uploaded to a folder it will automatically move to a different folder.


For example if a user saves a document to a certain folder (let's call it 'Pending') because it's not necessarily finished as it needs input from someone else, it will automatically move (to a 'Complete' folder) it once this person updates or modifies it because the date & time are different to the date & time created.

 

I've struggled to make one to move the document so I tried to make a flow that will clone the original once it's been saved and put it into the 'Complete' folder and then delete the original from the 'Pending' folder. The trigger is also 'When a file is modified' but it currently runs the Flow the moment a document is saved into the 'Pending' folder.

 

Essentially what I need is to set it so that it only triggers the Flow if the Date Modified is greater than the Date Created. It needs to also take the time into accound & not just the date as very often these get done on the same day that they are uploaded.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User II
Dual Super User II

Re: Flow Based on Time & Date Modified being Greater than Created

The behavior you are seeing using the OneDrive Sync client is what I would expect.  The file is created on the Desktop and then synced to OneDrive by the OneDrive client.  That sync counts as a modification.  I don't really see an easy way to get around that since it actually does count as a modification.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

9 REPLIES 9
Highlighted
Dual Super User II
Dual Super User II

Re: Flow Based on Time & Date Modified being Greater than Created

Add the following code to the Trigger Conditions in Settings for the Trigger.  The Flow will then only trigger when Modified does not equal Created.

@not(equals(triggerBody()?['Created'],triggerBody()?['Modified']))

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
Regular Visitor

Re: Flow Based on Time & Date Modified being Greater than Created

Hi Thank you for your assistance.

 

I added the code to the Trigger Conditions as suggested but unfortunately it stopped the flow from running at all. I made changes to the document that I added last week in case it wasn't taking the time as part of the date created but the flow didn't run and therefore the file stayed in the same folder.

Highlighted
Dual Super User II
Dual Super User II

Re: Flow Based on Time & Date Modified being Greater than Created

Which trigger are you using?  I tested it with the When a file is created or modified (properties only) trigger and it works fine. If you are using a different trigger it may not be returning the created and modified properties.  In that case the filter will never work.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
Regular Visitor

Re: Flow Based on Time & Date Modified being Greater than Created

I'm using the 'When a file is Modified' trigger. I can only find the trigger you mentioned in your last update within the SharePoint triggers and not OneDrive for Business which is what is required. The only options I have in OneDrive for Business that I can use in a Trigger are:

  • For a selected file
  • When a file is created
  • When a file is created (preview)
  • When a file is created (properties only)
  • When a file is created (properties only) (preview)
  • When a file is modified
  • When a file is modified (properties only)
  • When a file is modified (preview)
  • When a file is modified (properties only) (preview)

 

Highlighted
Dual Super User II
Dual Super User II

Re: Flow Based on Time & Date Modified being Greater than Created

Sorry, i didn't pick up on the fact that this was OneDrive for Business (even though you had it in Bold print).  Anyway. if you are using OneDrive for Business you shouldn't need a filter.  In my testing the Modified trigger only fires after a file has been modified, not when it is first created.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
Regular Visitor

Re: Flow Based on Time & Date Modified being Greater than Created

That's okay! Thank you for your assistance, I've not had a chance to look at this since monday but I'm back on it now. The issue I was having before was that if I created a new document and saved it directly to the folder (the one with the trigger) it would automaticallty trigger the Flow and move it to the new folder. Maybe I took a wrong step along the way so I'll create a new flow from scratch and try it!

Highlighted
Regular Visitor

Re: Flow Based on Time & Date Modified being Greater than Created

Hi, hope you're well.

 

Sorry I've not been able to get back to you since wednesday.

 

I ran some tests and it appears to work as expected in the OneDrive Windows Explorer Filder set up, I can drag an item to the 'Pending' folder and it will stay in there as it's a copy and has not been modified, the last modified date is the same as before.

 

However if I do it in the OneDrive client, even by clicking and dragging the document it changed the last modified date to when I performed this action & therefore triggers the flow.


Is there a way around this?

Highlighted
Dual Super User II
Dual Super User II

Re: Flow Based on Time & Date Modified being Greater than Created

The behavior you are seeing using the OneDrive Sync client is what I would expect.  The file is created on the Desktop and then synced to OneDrive by the OneDrive client.  That sync counts as a modification.  I don't really see an easy way to get around that since it actually does count as a modification.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Highlighted
Regular Visitor

Re: Flow Based on Time & Date Modified being Greater than Created

Thank you for your help. I'll have to see if I can get people to use the Windows Explorer tool.

Helpful resources

Announcements
Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (12,252)