1

I need to start a flow when a document in a SharePoint online document library has been checked in. The responsible is added to the metadata of the library.

The flow checks if the responsible is equal to the editor of that document:

  • If it evaluate to true, the status of the document must change to publish,
  • Else the status of the document must change to draft and an approval must be send to the responsible:
    • If the approval is accepted, the status must change to publish,
    • Else the status must stay on draft and the editor must receive an email that it has been denied.

The problem is that I can't change the metadata of a document when it's not checked in. I've got this error:

The file is not checked out. You must first check out this document before making changes.

The reason why I don't want to trigger when a document is created or edited is because if the editors saved temporary, the flow run with an unfinished document. When it's checked in, the document is finished and then it has sense that the approval needs to start (when the condition for that evaluates successfully).

P.S.: This question continuous on this question: Trigger Flow when document in SharePoint has been checked-in.

1 Answer 1

1

The link you provided in your PS seems to have the answer. Run on created, and then check the check-in status like in the link. If the document is checked out, then go into a loop, wait a few minutes, and check again. Keep looping until the check-in status shows that the document is checked in.

4
  • I don't think it's a good idea to keep looping until the check-in because you can save it without a check-in. Maby 1 time is more then enough. I think there must also be a check for the last version of the check-in. Jan 4, 2019 at 16:56
  • 1
    People may forget to check a file in, and it could be checked out for hours/days. So either loop, or have some other mechanism for running the necessary process on items that didn't get triggered appropriately.
    – Mike2500
    Jan 4, 2019 at 17:03
  • And what if the save 2 times without a check and save it for a 3th time and than do a check-in? So there are 3 loops running. Jan 4, 2019 at 17:07
  • 1
    If your trigger is on modified, then instead of a loop, just have a condition that checks the check-in status, and if it's not what you need, then simply exit the workflow without doing anything else. So, if someone changes the doc 5 times and then checks it in, the workflow will run each time, doing nothing each time, until the time where it was checked in.
    – Mike2500
    Jan 4, 2019 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.