It gets stuck on Do until even when the file is checked back in. I am guessing it is because it does not know the file is checked back in. I have tried using 'Get file Properties' and 'Get Files (properties only)' as well with the same result. I am using this flow to update the file name in a document library after a new file has been created by a user by calling the SharePoint web services. The Flow will fail if the document was being edited by a user so I need a way to check for this and pause the flow until the user finishes editing the document.
3 Answers
Flow is a bit challenging to troubleshoot, as the UI doesn't show which step each item is from. So, your idea to do a get item in the loop is good, but I'll assume your do until "checked out" condition is using the checked out field from the original "when a file is created" step. (the get item doesn't update those values).
Instead, perhaps create a variable before the loop, and initialize it to the current value of checked out from the original trigger. Use the variable for the do until condition, and after the get item in the loop, set the value of the variable based on the result of the get item action.
-
I tried this. I tried using get item and get file properties to set the variable but it did not work. The loop just kept running. Nov 4, 2019 at 15:02
-
In these scenarios, I find it helpful to create a new list, and add items to in inside the loop. Add the current value of the variable so you can check and confirm it has what you expect. I wish there was an easier way to do logging, but that's the mechanism available).– Mike2500Nov 4, 2019 at 15:41
There are many "Checked Out" properties. Make sure you choose the correct property "Checked Out".
In your Do until action, the property "Checked Out" should be selected from the step "Get item" instead of from "When a file is created or modified (properties only)".
For example:
-
I did not know you can select different Checked outs. I selected the checked out from the Get file properties step but it did not work. The Do until just kept running. Nov 4, 2019 at 14:55
Your flow is running until the file is checked out. Where inside the flow is your file being checked out? The flow will trigger whenever the file properties are modified. So, if you check in, the flow will get triggered and it will run keep on running. Now, to stop the flow you will think, I should check out since while should stop after check out (because your condition says checkout equals true). But that is not the case.
Every time you modify the properties, a new flow gets triggered. So the first running instance when file is checked in keeps on running the do while block.
Please re-analyze the requirement and re-create the logic and post a new question with your requirement if you need help.
Thanks.
-
I use the checked out condition to check to see if the document is being edited by someone because otherwise the flow would failed with the error "locked for editing by user". Is there another way to check for this? Nov 4, 2019 at 14:09
-
Can you please explain your requirement in details in this question or a new question? Nov 5, 2019 at 5:06
-