cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Has a file been Modified

Hi - hoping someone can help my. I'm trying to create a flow that check whether a file has been modifed with a set time period, and if not to send a warning email. So far I have this pulled the file modifed date; subtracted 3 hours from the current UTC time. I then wanted to set up a condition to check that the modified datetime was greater than the substracted time. The logic looks like this

 

@greater(Int(formatDateTime(body('Get_file_metadata')?['LastModified'],'HH')), Int(formatDateTime(('Subtract_from_time'),'HH')))

But I keep getting this error

 

The template validation failed: 'The template action 'Condition' at line '1' and column '1698' is not valid: "Unable to parse template language expression 'greater(Int(formatDateTime(body('Get_file_metadata')?['LastModified'],'HH')), Int(formatDateTime(('Subtract_from_time'),'HH')))': expected token 'Identifier' and actual 'LeftParenthesis'.".'.

 

My frist attempt was this 

 

@greater(formatDateTime(body('Get_file_metadata')?['LastModified'],'yyyy-MM-ddThh:mm:ss'), formatDateTime(('Subtract_from_time'),'yyyy-MM-ddThh:mm:ss'))

 Any help would be geatly apprieiated. 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Has a file been Modified

Hi @andyb2,

 

Could you please share a screenshot of the configuration of your flow?

Could you please share more details about the "Subtract_from_time" in your flow?

 

I have made a test on my side and have created a flow as below:

Capture.PNG

 

 

The expression in the Condition as below:

@greater(formatDateTime(body('Get_file_metadata')?['LastModified'], 'yyyy-MM-ddTHH:mm:ssZ'), formatDateTime(subtractFromTime(utcNow(), 3, 'Hour'), 'yyyy-MM-ddTHH:mm:ssZ'))

If the file is modified less than 3 hours from the current UTC time, the flow would run successfully as below:

Capture.PNG

 

 

If the file is modified greater than 3 hours from the current UTC time, the flow would run successfully as below:

Capture.PNG

 

 

Best regards,

Alice

 

 

 

 

View solution in original post

3 REPLIES 3
Highlighted
Community Support
Community Support

Re: Has a file been Modified

Hi @andyb2,

 

Could you please share a screenshot of the configuration of your flow?

Could you please share more details about the "Subtract_from_time" in your flow?

 

I have made a test on my side and have created a flow as below:

Capture.PNG

 

 

The expression in the Condition as below:

@greater(formatDateTime(body('Get_file_metadata')?['LastModified'], 'yyyy-MM-ddTHH:mm:ssZ'), formatDateTime(subtractFromTime(utcNow(), 3, 'Hour'), 'yyyy-MM-ddTHH:mm:ssZ'))

If the file is modified less than 3 hours from the current UTC time, the flow would run successfully as below:

Capture.PNG

 

 

If the file is modified greater than 3 hours from the current UTC time, the flow would run successfully as below:

Capture.PNG

 

 

Best regards,

Alice

 

 

 

 

View solution in original post

Highlighted
New Member

Re: Has a file been Modified

Thank Alice. That seems to be working perfectly. 

 

Originally I was doing the time substraction using the "Get Current Time" and "Subtract from Time" modules in Flow, but your solution appears to be doing that in one step which is great.

 

Thanks a million.,

Highlighted
New Member

Re: Has a file been Modified

Hi @v-yuazh-msft Alice,

 

Is this flow run automatically ? I tried to follow the same steps and it seems it is not working... (Keep in mind I'm new user on this platform).

 

My business case is similar to the original. I have an excel online file supposed to be updated every 7 days. If not, it will send an email to my colleague as a reminder.

 

Thank you!

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Users online (7,408)