cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
andyb2
Level: Power Up

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
Community Support Team
Community Support Team

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

2 REPLIES 2
Community Support Team
Community Support Team

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

andyb2
Level: Power Up

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.,

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,096)