Wednesday, January 25, 2012

How to Delete Old Versions of a K2 blackpearl 4.5 Workflow

  1. Go to the K2 workspace on the machine that K2 is running on (Example URL: http://domainname.com/workspace/Navigation/Navigation.aspx)
  2. Click on Management (in the top nav) > Management Console
  3. Expand the node for the machine that is running K2 > Workflow Server > Processes > WorkflowName
  4. For each workflow node, do the following:
    1. Expand the workflow node (e.g. Workflow1, Workflow2, etc.)
    2. Click on the 'Versions' node
    3. Click on 'Delete Process' in the top navigation menu in the panel to the right
    4. On the 'Delete Process' modal, select the following options:
      • Select the 'Delete all versions except default version' radio button
      • Check the 'Delete all historical (log) data based on the versions deleted' checkbox
      • Click the 'Show Dependencies' button in the top nav
      • Click the 'Delete' button in the top nav
      • Confirm the delete by clicking the 'Yes' button on the Warning message box
      • You can validate that the old versions of the workflow were deleted by going back to the Versions node of the workflow and checking that only 1 version of the workflow exists in the list.

How to Find Out the Error in a K2 blackpearl 4.5 Workflow Process Instance

Sometimes looking through the logs on the K2 Workspace or Process Portal is just too slow. Run the following SQL query on the K2Server database:

USE K2Server

SELECT TOP 1000 *
FROM dbo._ErrorLog WITH(NOLOCK)
ORDER BY Date DESC
 
SELECT TOP 1000 *
FROM dbo._ProcInst WITH(NOLOCK)
ORDER BY StartDate DESC

How to Fix the 'Master Key is Not Open' Error in K2 blackpearl 4.5

Question

When I go to the following URL, I get a runtime error:
http://{sharepoint site}/sites/UP/K2/_layouts/K2/Reports/ReportSettings.aspx?ReportID=11&PageTitle=Process Instances

I look in the event log and I see the following error:
8060 ProcessPacket Error, Please create a master key in the database or open the master key in the session before performing this operation. The key ’SCSSOKey’ is not open. Please open the key before using it.

Do you know how I can fix this through the K2 UI? I found this post online but I don’t have access to the K2 databases:
http://www.k2underground.com/forums/t/13277.aspx

Answer:

Run the following script on your K2 database

-- Purpose: K2 has an error with the master key, and this is the method K2 provided to fix the issue

USE {your VM machine name}_K2Hostserver
DROP SYMMETRIC KEY SCSSOKey
DROP CERTIFICATE SCHostServerCert
DROP MASTER KEY
CREATE MASTER KEY ENCRYPTION BY PASSWORD = '5CE05F96-98A1-475C-9E8C-5053F057D312'
CREATE CERTIFICATE SCHostServerCert
WITH SUBJECT = 'Host Server Certificate', START_DATE = '01/01/2007', EXPIRY_DATE = '01/01/2017'
CREATE SYMMETRIC KEY SCSSOKey WITH ALGORITHM = TRIPLE_DES
ENCRYPTION BY CERTIFICATE SCHostServerCert

USE {your VM machine name}_K2SmartBroker
DROP SYMMETRIC KEY SCSSOKey
DROP CERTIFICATE SCHostServerCert
DROP MASTER KEY
CREATE MASTER KEY ENCRYPTION BY PASSWORD = '5CE05F96-98A1-475C-9E8C-5053F057D312'
CREATE CERTIFICATE SCHostServerCert
WITH SUBJECT = 'Host Server Certificate', START_DATE = '01/01/2007', EXPIRY_DATE = '01/01/2017'
CREATE SYMMETRIC KEY SCSSOKey WITH ALGORITHM = TRIPLE_DES
ENCRYPTION BY CERTIFICATE SCHostServerCert

USE {your VM machine name}_K2Smartbox
DROP SYMMETRIC KEY SCSSOKey
DROP CERTIFICATE SCHostServerCert
DROP MASTER KEY
CREATE MASTER KEY ENCRYPTION BY PASSWORD = '5CE05F96-98A1-475C-9E8C-5053F057D312'
CREATE CERTIFICATE SCHostServerCert
WITH SUBJECT = 'Host Server Certificate', START_DATE = '01/01/2007', EXPIRY_DATE = '01/01/2017'
CREATE SYMMETRIC KEY SCSSOKey WITH ALGORITHM = TRIPLE_DES
ENCRYPTION BY CERTIFICATE SCHostServerCert

USE {your VM machine name}_K2SQLUM
DROP SYMMETRIC KEY SCSSOKey
DROP CERTIFICATE SCHostServerCert
DROP MASTER KEY
CREATE MASTER KEY ENCRYPTION BY PASSWORD = '5CE05F96-98A1-475C-9E8C-5053F057D312'
CREATE CERTIFICATE SCHostServerCert
WITH SUBJECT = 'Host Server Certificate', START_DATE = '01/01/2007', EXPIRY_DATE = '01/01/2017'
CREATE SYMMETRIC KEY SCSSOKey WITH ALGORITHM = TRIPLE_DES
ENCRYPTION BY CERTIFICATE SCHostServerCert

How to Stop Running Process Instances of K2 blackpearl 4.5 Workflows


There are two ways to do this:

A.      From the K2 Workspace:

1.    Go to the K2 workspace on the machine that K2 is running on (Example URL: http://domainname.com/workspace/Navigation/Navigation.aspx

2.    Open the Management Console

3.    Open the node for the machine that is running K2.

4.    Right click on the processes node and click "Manage All Processes"

5.     Click Select All, Stop in the top menu bar. Click OK.

6.    Click Select All, Remove in the top menu bar. Make sure the checkbox is checked. Click OK.

7.     Repeat step 5 for all pages of active or running processes.


B.      From the K2 Process Portal

1.     Go to the K2 process portal (Example URL: http://application.domainname.com/sharepointSite/K2ProcessPortal/).

2.     On the landing page, go to the "Instances Summary" section.

3.     Click on the number for the workflow process under the "Running" column that you want to stop.

4.     A list of the different running processes will be displayed. Go to the page with the workflow instances that you want to stop. Click on the item and it will present a dropdown. Then click stop.

How to Debug a K2 blackpearl 4.5 Workflow

To debug a K2 workflow and step-through code, follow the instructions on this website: http://blog.mgallen.com/?p=153