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

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

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

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

Highlighted

Hello 

 

How do you prevent error if the date is null ?

 

Thanks

Highlighted
Dual Super User III
Dual Super User III

@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



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted

@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 ?

Highlighted
Dual Super User III
Dual Super User III

@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



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted

@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')
Highlighted
Dual Super User III
Dual Super User III

@M_DONNAYThank you for sharing!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (11,629)