Forum Discussion

Sharepoint_Chris's avatar
Sharepoint_Chris
Copper Contributor
Jan 04, 2022
Solved

Populate a date column automatically

How do I populate a date column automatically when the status field is changed to "Implemented" with a Sharepoint List?   I am new to using PowerAutomate, and I am trying to have the project close ...
  • RobElliott's avatar
    Jan 04, 2022

    Sharepoint_Chris this is not difficult and it compares the current version of the item with the previous one, so you MUST make sure that in your list settings -> versioning settings that Item Version History is set to on. I normally set the number of versions to 10.

     

    In this example I prepared for a similar forum post a while back we are checking whether the Status column has changed and, if so, whether the status is now Completed. If it is then add today's date in the Completed column.

     

    The trigger in the flow is "when an item or a file is modified":

     

     

    The first action is "get changes for an item or a file (properties only)". For the ID field select ID from the when an item or a file is modified section of the dynamic content box. 

     

    For the Since field you need to add the following expression to get the previous version:

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

     

     

    Next, add a condition:

     

    • in the left box select Has Column Changed: Status
    • in the middle box select is equal to
    • in the right box type true

     

     

    Add a new row to the condition and if your SharePoint status column is a choice column then select Status value, if it's not a choice column then just select Status, and again select is equal to and then type Completed in the right hand box:

     

     

    Finally, you can leave the red if no channel empty, but in the green if yes channel add an Update item action and in the Completed field add an expresion of utcNow()

     

     

    So the Status has changed to completed and the flow runs and adds today's date into the Completed field.:

     

     

     

    Rob
    Los Gallardos
    Microsoft Power Automate Community Super User

Resources