web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Send a task to review ...
Power Automate
Unanswered

Send a task to review document annually

(0) ShareShare
ReportReport
Posted on by 36

I have been working on a flow to send a task when any document has not been modified for one year. It is actually 11 months so we can provide evidence our documents are being reviewed. I have a flow that will reoccur daily and check the modified date but I only want to create a single task after 11 months (or 330 days).  I have got it to work with less than or equal to but that will generate a task every day after that.  I have tried a condition and filter array. The filter array does not actual filter my documents down. During my test it creates a task for every document and the condition comes back false.  I have also calculated the days between dates and equal that to 30. 

Here are the expressions I have used.

 

This example the document is 110 days old.  Modified is equal to 

 

addDays(utcNow(),-110,'yyyy-MM-dd')

 

 Filter array 30 days before expiration

 

@equals(formatDateTime(utcNow(), 'yyyy-MM-dd'), addDays(item()?['OData__dlc_ExpireDate'], -30))

 

Count Days 

 

eq(div(sub(ticks(formatDateTime(utcNow(),'yyyy-MM-dd')),ticks(outputs('Get_file_metadata')?['body/OData__dlc_ExpireDate'])),864000000000),30)

 

Any advice on getting any of these to work.  

Categories:
I have the same question (0)
  • ScottShearer Profile Picture
    25,270 Most Valuable Professional on at

    @bbabcck81 

    A better way to approach this might be to use a recurrence trigger that fires daily and a get files properties only action that only retrieves items which meet your criteria.  You'll use an OData filter (query filter) for this.  Here is a good blog post on the topic.

    Let me know if you need an example.

     

     

     

  • bbabcck81 Profile Picture
    36 on at

    It ran but did not create a task. That is better than not filtering anything but there is a document that should match this query. Let me know if you have a better example. 

    Modified eq formatDateTime(addDays(utcNow(),-110,'yyyy-MM-dd'))
  • ScottShearer Profile Picture
    25,270 Most Valuable Professional on at

    Try changing your filter to something like this:

    Modified ge formatDateTime(addDays(utcNow(),-110,'yyyy-MM-dd')) and Modified lt formatDateTime(addDays(utcNow(),-109,'yyyy-MM-dd'))

     

    The reason is that modified includes the time.

     

  • bbabcck81 Profile Picture
    36 on at

    I am getting "The expression "Modified ge 2021-03-03T00:00:00.0000000 and Modified lt 2021-03-04T00:00:00.0000000" is not valid. Creating query failed."

  • Verified answer
    bbabcck81 Profile Picture
    36 on at

    FYI I ended up adding a column to count the number of days from the last edit. Then I added the code to say if it was between the two values. Roundup was not working for the date to a whole number. 

     

    Age ge 110 and Age lt 111

     

     

  • Verified answer
    lsheltonSTO1 Profile Picture
    113 Most Valuable Professional on at

    I have a similar flow but it's scheduled - every morning it checks for files that are 30 days out from needing review (335 days so same as yours).  It's worked really well so far - I initialize variables for the number of days so it's easier to change and then use that to configure a "Reset Date" variable: 

    lsheltonSTO1_0-1624481954898.png

    The addDays formula is:

    addDays(utcNow(), variables('varNumDays'), 'yyyy-MM-dd')

     

    I call it the reset date because then I change the status from Approved to Draft along with sending a reminder email that the file needs reviewed.  The only other modification I make is in my Get Items that follows:

    lsheltonSTO1_1-1624482102999.png

    So the Filter Query only gets items where their last update date is equal to the "reset date" and that's what gets reset/emailed about.  Just another option to consider that I figured out and like!

  • ScottShearer Profile Picture
    25,270 Most Valuable Professional on at

    @bbabcck81 

    I'm glad that you got it working!

    You said that you added a column.  Please note that if it is a calculated column that your values will not be updated unless the document or document properties are edited.

     

     

  • bbabcck81 Profile Picture
    36 on at

    I was wondering about the variables. Thank you!!!

  • bbabcck81 Profile Picture
    36 on at

    @lsheltonSTO1 Do I need to format the Modified Date? I was going to use the expiration date but it is not on all documents (Some are too old). I can also create a new column if that might work better. 

     

  • lsheltonSTO1 Profile Picture
    113 Most Valuable Professional on at

    I didn't do anything to format my date columns - are you just using the out of the box Modified Date?  I have two date columns I use in my total solution, Completion Date which is updated to the current date when the file is approved, and Review Date, which is a calculated column with the formula 

    =[Completion Date]+365

    Then I use that Review Date column to detect 30 days out with my daily scheduled flow.

     

    In your case, if you are wanting yearly reviews, we are still working out our go live and figuring out how to best determine when these documents we are moving into SharePoint need review without doing it manually.  (I have a feeling that I'm going to be doing it manually) So, I don't have any tested advice there for you with that part of the process unfortunately.  But I didn't have to format any of the dates beyond the basic date field (without time).

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard