cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Community Support
Community Support

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

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

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

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
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (33,171)