cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rebornScholar86
Frequent Visitor

Checking if a file is updated in a SharePoint library

Hi all, I am working on an Automated Flow using the SharePoint "When an item or a file is modified" trigger to process a PDF file in a SharePoint library for multiple stages of approvals. At each approval stage, a single approver needs to review the PDF file, stored in the SharePoint library, and either reject the approval in the Power Automate Approval Center, or digitally sign the PDF and re-upload the file and then approve the action in the Power Automate Approval Center. I am using the "Get Changes for an item or a file (properties only)" action to check if the "Workflow Status" field I created was updated to trigger each approval stage. I am also using a Do Until loop using a boolean variable to re-generate the approval at each stage in the event a reviewer approves the action in the Approval Center without having updated the PDF file in the SharePoint library, making sure to escape out of the Do Until loop in the event the reviewer rejects the action. I know there is no way to actually check if the reviewer digitally signed the document, so I am hoping that simply checking if the file was modified and checked in will be sufficient.

 

I have the flow working to trigger each approval stage by using the "Has Column Changed: Workflow Status" property, but I am unsure on how to go about checking whether the file was updated or not. My initial thought is to use another "Get Changes for an item or a file (properties only)" action after the "Wait for Approval" action and subsequent "Approve" Condition using the window between timestamps of the Request Date and Completion Date (i.e., when was the approval created and when did the reviewer approve the action) to determine if the file version changed, as an indirect proxy of the reviewer updating the file with their digital signature. Can I use the "Is Current Version" property from "Get Changes for an item or a file (properties only)" to determine if the file version changed during the approval window, do a comparison to check that the "Until Version Number" from the post-approval "Get Changes for an item or file" is greater than the "Until Version Number" from the pre-approval "Get Changes for an item or file", or do I need to use a "Send an HTTP request to SharePoint" action to the SharePoint API to get this information? If I need to use the SharePoint API, how might I go about this? Otherwise, how do I go about checking the reviewer has updated the file in the library?

 

Thanks!

2 REPLIES 2
v-litu-msft
Community Support
Community Support

Hi @rebornScholar86,

 

You could check if the Modified time greater than the approval request sent time, to determine the file whether to be modified or not. Steps as below:Screenshot 2020-12-25 110221.jpg

 

Screenshot 2020-12-25 110307.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-litu-msft ,

 

Unfortunately this does not work for me, as when I update the PDF file in the SharePoint document library with versioning turned on, it creates a new file and forces me to manually re-enter all the metadata, resulting in a new item with a new ID being created. It doesn't modify the original library item containing the original file. This is already a problem, as I need SharePoint to replace the original PDF file with the updated PDF file, retain the metadata without it needing to be copied over, retain the original document library ID, and increase the major version number.

 

Here is how I attempted to implement your solution above, but due to the above mentioned issue, it does not complete the loop by setting boolFileUpload to true after the Yes conditional branch of "Check if file was updated by Immediate Supervisor"

 

firstApprovalBranchWithFileModifiedChange.PNG

 

Here is an expanded view where I am using the Request date and Completion Date timestamps for my window

firstApprovalBranchWithFileModifiedChangeTriggers.PNG

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,154)