Skip to main content
Nintex Community Menu Bar

How to check-in K2 form on behalf of another user

  • February 18, 2015
  • 3 replies
  • 311 views



 

Symptoms

 


How to check-in K2 form on behalf of another user?
 

 

Diagnoses

 


Usually this happens when a user leaves the company or goes on vacation for a long period and the developers are stuck with a checked out/in form and they cant access it.
You can change this with the K2 DB with the correct scripts.
 

 

Resolution

In SQL Management Studio, you can run this SQL query to find the Form that has been checked out:

SELECT * FROM [K2].[Form].AuditLog

For example, let's say I have a Form that has been checked out by Bob on 06-02-2014 at 12:47, then please copy the following:

UserID = K2:DENALLIXBob
ID = 4E04425C-58A1-4AB0-95AF-7D219235F381

In your K2 Database, browse to K2 -> Programmability -> Stored Procedures

If you want to Check In the Form *with* the changes that Bob has made, find the Proc named Form.aCheckInForm

If you want to Check In the Form *without* the changes that Bob has made, find the Proc named Form.aUndoFormCheckOut

Right click -> Execute Stored Procedure

Pass the values you copied above to the fields in question.

UserID = K2:DENALLIXBob
ID = '4E04425C-58A1-4AB0-95AF-7D219235F381'

* Please make sure* you use the single quotes before and after the ID (see above)

If everything goes well, the Form should be Checked In and you can refresh your K2 Designer to reflect the results.

As always, please test this in a Test Environment first.

 

 



 

3 replies

Forum|alt.badge.img+2
  • February 9, 2017

Has Form.aCheckInForm been removed in 4.7?
I can't seem to find it.

Form.aUndoFormsCheckOut is still there


Forum|alt.badge.img+3

Forum|alt.badge.img+7
  • January 17, 2019

To help you by generating the query to executing according the form or view display name:

 

  
--Undo checkout for one form/view:
--UndoCheckout:
DECLARE @DisplayNameToFound nvarchar(100)
SET @DisplayNameToFound='CurrentTickets' --FILL HERE THE FORM OR VIEW DISPLAY NAME


--Check first on the view:
DECLARE @FormOrViewId nvarchar(100)
SET @FormOrViewId = (SELECT [View].ID FROM [Form].[View] WHERE [View].DisplayName = @DisplayNameToFound)

IF @FormOrViewId IS NULL BEGIN
SET @FormOrViewId = ( SELECT [Form].ID FROM [Form].[Form] WHERE [Form].DisplayName = @DisplayNameToFound)
END

SELECT 'Form found: ''' + DisplayName + ''' Version: '+ convert( varchar, [Form].Version) AS 'Information' FROM [Form].[Form] WHERE Id=@FormOrViewId
UNION
SELECT 'CheckedOutBy:' + ISNULL([Form].CheckedOutBy,'WARNING: Seems to be not checked out!' ) FROM [Form].[Form] WHERE Id=@FormOrViewId
UNION
SELECT 'View found: ''' + DisplayName + ''' Version: '+ convert( varchar, [View].Version) FROM [Form].[View] WHERE Id=@FormOrViewId
UNION
SELECT 'CheckedOutBy:' + ISNULL([View].CheckedOutBy,'WARNING: Seems to be not checked out!' ) AS 'Information' FROM [Form].[View] WHERE Id=@FormOrViewId
ORDER BY 1 DESC

--Proposition of StatementToExecute:
SELECT 'declare @return_value int' + char(13) + char(10) +
'exec @return_value = [Form].[aUndoFormsCheckOut] ' + char(13) + char(10) +
'@UserID = ''BY SQL - Original:' + ISNULL(CheckedOutBy, (select CheckedOutBy from [Form].[Form_Design]
WHERE [Form_Design].ID=[Form].ID) + ' Only on Form_Design)')
+ ''', ' + char(13) + char(10) + --UserId is to used only for logs (procedure eLogMessage: table [AuditLog])
'@IDs = '''+@FormOrViewId +''', ' + char(13) + char(10) +
'@ClientStack = null' + char(13) + char(10) + char(13) + char(10) +
'select * from [Form].[AuditLog] order by 1 desc ' + char(13) + char(10) + char(13) + char(10) +
'--For corresponding Form :'+ char(13) + char(10) +
'select TOP 50 * from [Form].[AuditLog] WHERE Data='''+@FormOrViewId +''' order by 1 desc ' AS "Advised Statement" FROM [Form].[Form] WHERE Id=@FormOrViewId
UNION
SELECT 'declare @return_value int' + char(13) + char(10) +
'exec @return_value = [Form].[aUndoViewsCheckOut] ' + char(13) + char(10) +
'@UserID = ''BY SQL - Original:' + ISNULL(CheckedOutBy, (select CheckedOutBy from [Form].[View_Design]
WHERE [View_Design].ID=[View].ID) + ' Only on View_Design)')
+ ''', ' + char(13) + char(10) + --UserId is to used only for logs (procedure eLogMessage: table [AuditLog])
'@IDs = '''+@FormOrViewId +''', ' + char(13) + char(10) +
'@ClientStack = null' + char(13) + char(10) + char(13) + char(10) +
'select * from [Form].[AuditLog] order by 1 desc '+ char(13) + char(10) + char(13) + char(10) +
'--For corresponding view :'+ char(13) + char(10) +
'select TOP 50 * from [Form].[AuditLog] WHERE Data='''+@FormOrViewId +''' order by 1 desc ' AS "Advised Statement" FROM [Form].[View] WHERE Id=@FormOrViewId