cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Building a flow to check that a document was updated today using modified date

Hi all

 

I'm trying to build a flow that will check if a document in Sharepoint was updated today.

I've used get file metadata to return the modified date but am struggling with any expression to compare this to today's date.  I know this is probably due to modified date using date/time or issues with the date format.

Here's what I've got at the moment but it generates an error.   Even if I could just compare day of week that would be fine.  
The overall aim is to check that a job that updates files every day has successfully run or not.

 

@not(equals(dayOfWeek(body('Get_file_metadata')?['LastModified']), dayofWeek(utcnow('dd-mm-yyyy'))))

 

Thanks for your help

1 ACCEPTED SOLUTION

Accepted Solutions

Hi IanROH,

 

I assume that you scenario should be using flow to check if the last modified date of the file is equal to today’s date. If not, send you an email or a notification.

 

Please try to use formateDateTime function to format the date format of last modified date and today’s date to the same.

 

I have created a flow to test this issue on my side. The function I am using for the Condition is:

@equals(formatDateTime(body('Get_file_metadata')?['LastModified'],'yyyy-MM-dd'),formatDateTime(utcnow(),'yyyy-MM-dd'))

 

Following picture is a screenshot of my flow configuration.

3.PNG

 

Please take this for a reference. Hope it also works for you.

 

Please check more details about formatDateTime function at here:
https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

The error message isi

 

Unable to process template language expressions for action 'Condition' at line '1' and column '2152': 'In function 'dayofWeek', the value provided for date time string '14-30-2017' was not valid. The datetime string must match ISO 8601 format.'.


Right now the modified date on the document is today's date so not sure where 14-30 is coming from!

Hi IanROH,

 

I assume that you scenario should be using flow to check if the last modified date of the file is equal to today’s date. If not, send you an email or a notification.

 

Please try to use formateDateTime function to format the date format of last modified date and today’s date to the same.

 

I have created a flow to test this issue on my side. The function I am using for the Condition is:

@equals(formatDateTime(body('Get_file_metadata')?['LastModified'],'yyyy-MM-dd'),formatDateTime(utcnow(),'yyyy-MM-dd'))

 

Following picture is a screenshot of my flow configuration.

3.PNG

 

Please take this for a reference. Hope it also works for you.

 

Please check more details about formatDateTime function at here:
https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Anonymous
Not applicable

Hi Mabel


That worked perfectly - thanks so much for your help with this!

 

I'm now using to check that our overnight interfaces have run correctly and to email the support team if not.

Best wishes
Ian

derekdsl
New Member

Dear @v-yamao-msft,

 

I'm trying to do the same however, I want to check on the specific file if the lastmodified date is greater then the last 15 minutes, if so, indeed it should sent an email notification. Are you able to help me out with that?

 

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (3,436)