Check for checked-in status in workflow

by mgargiullo » Thu Jun 18, 2015 3:28 pm

I've had a few users launch an approval workflow of documents they haven't checked in yet and it causes all kinds of issues.

I need to create a workflow that will show an error if it's launched while the document is checked-out. Can this be done?
mgargiullo
 
Posts: 6
Joined: Thu Jun 18, 2015 3:25 pm

by Roman Rylov » Wed Jun 24, 2015 12:18 pm

Hello

I can suggest solution which was described on Stack Overflow

The fix to this is to have the workflow checkout the document, make any changes and then check it back in.

In code you would do this with a custom event handler. Check out the sharepoint SDK or MSDN for info on the object model.

In SharePoint Designer set your workflow to look like this:

Check "Automatically start this workflow when a new item is created" or "Automatically start this workflow when a new item is created" or select both options.

Hit next.

On the following page leave the conditions section blank.

In the action settings setup your workflow to look like this:

Code: Select all
Check out item in <Current Item>
     then Wait for <Whatever fields you need to be set or actions you need>
     then Check in item in <Current Item> with comment: <Comment>

You can break this out into steps as well. For instance:

Code: Select all
Step One - Check out current item
Step Two - Custom stuff you need to do
Step Three - Check in current item
User avatar
Roman Rylov
 
Posts: 330
Joined: Tue Nov 11, 2014 6:25 pm


Return to Workflow Actions Pack for Office 365