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

schedule a flow to run every week and if a expired date in the library is passed todays date then...

Hello,

 

I wanting to schedule a flow to run every week and if the expired date in a document library is greater than the current date, then create a planner entry so the employee can update the document.  Is this possible and how?

 

I can see you can schedule a flow but i cant see how to then relate that flow a field in a document library.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: schedule a flow to run every week and if a expired date in the library is passed todays date the

Hi resolver101757,

 

Please consider to use the action “SharePoint-Get files(Properties only)”, then add a Condition after the action to filter the dates that are greater than current date.

 

At here, workflow definition language will work for you. Please check more details function at here:
https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language

 

Following screenshot is the flow I created on my side.


Please make sure you have added a Date column in the library.


About the Condition, in basic mode, select the date column from the dynamic content, then click “Edit in advanced mode”, configure the code with greater function.


Besides, you also need to format the current date to the same format with the date column in your library. So please consider to use formatDateTime function.

3.PNG

 

Please try it on your side and feel free reply if you need more help.

 

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

7 REPLIES 7
Community Support Team
Community Support Team

Re: schedule a flow to run every week and if a expired date in the library is passed todays date the

Hi resolver101757,

 

Please consider to use the action “SharePoint-Get files(Properties only)”, then add a Condition after the action to filter the dates that are greater than current date.

 

At here, workflow definition language will work for you. Please check more details function at here:
https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language

 

Following screenshot is the flow I created on my side.


Please make sure you have added a Date column in the library.


About the Condition, in basic mode, select the date column from the dynamic content, then click “Edit in advanced mode”, configure the code with greater function.


Besides, you also need to format the current date to the same format with the date column in your library. So please consider to use formatDateTime function.

3.PNG

 

Please try it on your side and feel free reply if you need more help.

 

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

M_DONNAY
Level: Powered On

Re: schedule a flow to run every week and if a expired date in the library is passed todays date the

Hello 

 

How do you prevent error if the date is null ?

 

Thanks

Dual Super User
Dual Super User

Re: schedule a flow to run every week and if a expired date in the library is passed todays date the

@M_DONNAY

You can convert NULL into a default value by applying a "coalesce" based expression

https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language

Hope this helps





If anyone is trying to help you with an issue, the fastest way to say thanks is by kudoing. Be grateful, Thumbs up!

Proud to be a Flownaut!





M_DONNAY
Level: Powered On

Re: schedule a flow to run every week and if a expired date in the library is passed todays date the

@efialttesThank you for the tip 🙂

 

In my "apply to each", I have changed the condition and added  the coalesce (condition that falled in error when the date was empty):


@lessOrEquals(formatDateTime(coalesce(items('Apply_to_each')?['Launch_x0020_Date'], '2000-01-01T00:01:00Z'), 'dd/MM/yyyy'), formatDateTime(utcNow(), 'dd/MM/yyyy'))

 

No more error, but it seems that it returns always the '2000-01-01T00:01:00Z' and thus do not evaluate the condition with the "Launch Date" value

 

What am I doing wrong ?

Dual Super User
Dual Super User

Re: schedule a flow to run every week and if a expired date in the library is passed todays date the

@M_DONNAY

 

Can you inspect the content of items('Apply_to_each')?['Launch_x0020_Date'] ?

 

You can do so, for example, by adding a Compose action block just before the condition evaluation and assigning 

items('Apply_to_each')?['Launch_x0020_Date'] as an expression.

 

Once you save the flow, execute it. Then go to the FLow's Run History, click on the last iteration executed and verify the value assigned to the Compose action Block in each iteration of the Apply to each

 

Please note I have never used the expression items('Apply_to_each') yet; I tend to implement item() instead. 

 

Hope this helps





If anyone is trying to help you with an issue, the fastest way to say thanks is by kudoing. Be grateful, Thumbs up!

Proud to be a Flownaut!





M_DONNAY
Level: Powered On

Re: schedule a flow to run every week and if a expired date in the library is passed todays date the

@efialttesThanks. It works now. Robot Happy

 

I used an incorrect internal label

coalesce(items('Apply_to_each')?['Start_x002F_Launch_x0020_date'],'2000-01-01T00:01:00Z')
Dual Super User
Dual Super User

Re: schedule a flow to run every week and if a expired date in the library is passed todays date the

@M_DONNAYThank you for sharing!





If anyone is trying to help you with an issue, the fastest way to say thanks is by kudoing. Be grateful, Thumbs up!

Proud to be a Flownaut!





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 (4,797)