This KB will outline how to force a check-in or check-out of a view or form.

A common scenario is a user leaving a company without checking in a SmartForm view or form.

Before You Begin

Please note: the steps below include direct manipulation of the K2 database. You do this at your own risk. Please contact K2 Support if you need any assistance. Also read: http://help.k2.com/onlinehelp/k2blackpearl/devref/current/default.htm#Database_Reference.html

Always create a full backup of the K2 database prior to running the below steps.


1. Stop K2 service

2. Apply DB backup

3. Start K2 service

How-to Steps

I'm using an example User and Form ID below. Please change as necessary.

Step 1: get the info.

--For checked out views

SELECT ID, DisplayName, CheckedOutBy

FROM Form.View_Design

WHERE CheckedOutBy = 'K2:Denallix\Administrator';

--For checked out forms

SELECT ID, DisplayName, CheckedOutBy

FROM Form.Form_Design

WHERE CheckedOutBy = 'K2:Denallix\Administrator';

Step 2: run the check-in.

The 'Type' in the table variable will be 'F' if you are checking in a form and a 'V' if you are checking in a view.


DECLARE @MyTable Form.ContextTableType;

INSERT INTO @MyTable([ID], [Type])

VALUES (N'97CD2824-D36D-46A7-97AF-BA0F2DFF06CD', 'F'); -- this is the ID returned from the query above

EXEC [Form].[aCheckInContexts] @UserID= N'K2:DENALLIX\Administrator', @ContextData=@MyTable;

--Note: the ID above must be in the format: N'<view\form ID>'

That will check in the forms\views you need.

Additional notes:

- It is recommended to run the check-ins one at a time.

- If you would prefer to undo the checkout, you can perform a similar process and use the [K2].[Form].[aUndoViewsCheckout] sproc.

- Testing this first by creating a test view\form, leave it checked out and then run through the process.