SharePoint 2010, I have a workflow running when a document is added to a document library. The workflow checks out the document, makes a change and then attempts to check it back in; however it fails at the check-in step with the message "Error checking in item. The workflow failed because the action requires the document to be checked out."
Solved! Go to Solution.
This will sound dumb but the first thing to do is check to make sure both your check in and check out are pointing to the same place (Check In From and Check out From).
Also, the help says the same person checking in has to be the same person who checked it out. This shouldn't be your problem since the time is so close together. I would log the user prior to check out and prior to check in.
Thanks very much for your response.
The check out, edit, and check in all happen sequentially within the workflow initiated by the same user...I don't believe it's possible that that person checking in would be different than the person checking out, since it's the same person.
Also check out from and check in to are all "Current Item"...
And...if it's any use...the step inbetween these two is...
And I took your suggestion to log the user during the update...same user:
And while it's probably not relevant, the same functionality works just fine as a SharePoint workflow. We actually built this out in a site using SharePoint workflows, and are now rebuilding it in another site substituting the Nintex workflows instead.
Yeah I didn't think it would be a user with it occurring so close in between but its better to check everything.
Everything looks good. Thanks for adding the extra screenshots it definitely helps. Whoever is running the workflow, do they have permissions to checkout items?
It's still in development so it's just me doing all the testing and I can check-out, edit, check-in no problem.
I had a similar issue and resolved it by doing two things. We are using the latest Sharepoint/Nintex workflow 2013 combination, so I'm not sure if both these additions are present in the 2010 version.
There is an control called "Wait for checkout status change" which I added immediately after the Check out control and obviously set the option within it to "Wait for document to be :Checked out". Interestingly I also added one of these to after the Check in too, but it didn't appear to work correctly. However, the other thing I did which seems to have got it working is to add a "Commit Pending Changes" control just prior to the check in.
As Mark suggested, use a commit pending changes after the check out, then again after the update. This is necessary because SharePoint batches changes. For a very detailed explanation, see Designing your Workflow - Commit Pending Changes Action NW2010 & NW2013
Doing so will make sure that the changes occur in the right order.
Thanks very much Mark,
This worked (but with one minor glitch that is really another question for another day).
So I checked out the document
Then waited until the document was checked out
Then I updated the item
Then waited for the item to update
Then committed pending changes
Then checked in the item
Every step was necessary.
The glitch was that the item update was chaning the item content type and the value of a lookup column, and then in the "wait for item to update" step I tried testing the column against the lookup display value and the lookup ID value. Neither worked and both cause the workflow to crash at this step. Testing against the content type change eventually worked.
Thanks for the response and the link to the article.
I did run into an issue where waiting for the value of a lookup field to change would crash the workflow. I was able to get around it by testing a different column, but remain curious about how one would/should test for a change in a lookup field. Would you compare against the ID value of the lookup, or the text/display value (or both, e.g. 234 or Banana or "234;#Banana" )
You potentially may need to do a commit just after your item update to make sure that the item update is actually processed prior to waiting for the item update step.
Although Andrew's link would suggest that the "Update item" and the "Wait for item Update" actions are both SharePoint batch actions and as such should occur in sequence.
Might be worth a go anyway.