Forum Discussion

tomscrace's avatar
tomscrace
Copper Contributor
Aug 11, 2021

Add date completed when status is changed

Is there a way to add Date Completed automatically when the status is changed to "Completed" in a List?

8 Replies

  • RobElliott's avatar
    RobElliott
    Silver Contributor

    tomscrace yes this can be done with a simple flow in Power Automate. You MUST make sure that versioning is activated in your list settings.

     

    In this example we'll change the status of Bedar to Completed:

    This is the trigger: 

     

     

    Next, add the get the changes for an item or a file (properties only) action. In the Since field we need to check what has changed since the previous version, so add the expression:

    sub(int(triggerOutputs()?['body/{VersionNumber}']),1)

     

     

    Next, add a condition to check it's the Status column that has cahnged AND the status is Completed

     

     

     

    If that is the case then update the item in the list with the current date and time in the Completed date/time column:

     

     

     Rob
    Los Gallardos
    Microsoft Power Automate Community Super User

    • kcgohlsen's avatar
      kcgohlsen
      Brass Contributor

      I just wanted to note that this flow works most of the time, but I came across an issue where the condition "has column changed" will run as false if more than just the Status field is updated (in my case, updating the Hours field as well). SharePoint will record each change as a separate version, and if they occur close enough together (I'm guessing within the same minute?), the flow will only consider the second update. I've solved this issue by updating the Since expression to look at the last 2 versions, rather than 1. I don't see any future issues with doing that, but is there a more elegant way to address the problem?

    • CallumGF22's avatar
      CallumGF22
      Copper Contributor

      Hi, Thanks for this - really useful. 

       

      The only issue i have is that the "completed" date that appears always updates to the current date. 

       

      For example, the date today is 27th March. If i had closed a ticket on the 23rd March, it now says that the completed date is 27th March (Today). How do i stop this from happening? 

      Thank you 

    • aaku40's avatar
      aaku40
      Copper Contributor

      RobElliott my update item is not the same as what you have shown. I have followed the steps but in the end I'm not getting the option to setup date when the status changes to Completed.

       

Resources