Welcome to K2 Underground Sign In | Join | Help

Difference in RepairError behavior in K2.net 2003 and K2 blackpearl

I saw this response from Blake (http://k2underground.com/forums/thread/25502.aspx) and I thought it interesting that the RepairError behaviour has changed.  I did some research on this and I thought it would be nice to share out my findings on the key changes in the RepairError bahaviour.

In K2.net 2003, the repair error would affect the code of the version that the process instance is running on.  So any changes would impact any running instances which is on the same process version.  Checking the “Repair All Instances” option was primarily to auto-retry all the error instances having the same error. Otherwise, I would have to retry each error instance individually, this could get tedious if there were a lot of similar errors.

It seems that the repair error behavior is different in K2 blackpearl as it creates a new version and re-runs the error instances on the new version. 
Depending on what is specified for the “Repair All Instances” option.

  • Checked – Deploys a new version and retries all instances with the same error on the new version.  The new version is also set as the default.
  • Unchecked – Deploys a new version and retries only the specific instance.  The default process version is not changed.

So this option now becomes quite useful in different scenarios.

  1. Unchecked – I have a specific error instance which is caused by a specific data error.  I could do some custom code to hard code the invalid values without impacting the other instances.
  2. Checked – I have a general error in the process which needs to be fixed across all running instances.

I hope this article helps you understand the differences in the options and also how they function when doing a RepairError.

Posted by johnny | 0 Comments

Quick Tip: How to connect a line back to the same activity

As most people would know, it's a pretty simple exercise in K2.net 2003 to draw a line back to the same activity.  You just have to pick the "U" shaped line type and draw it directly.

 This is pretty useful for cases where you want to do ad-hoc approval routing where the current approver can select another approver from a drop down list in the approving form.  Effectively the line rule just checks if the field containing the next approver name is empty or not.  If it is not empty, it will route back to the same client activity but with the selected user as the destination user.

Now, this can also be done with K2 blackpearl, but it isn't too obvious with the current line behavior.  When dragging a outcome line from a client activity and then trying to drag it back to the same edge, you will notice that the line jumps around instead.  This gets a bit annoying if you are expecting it to behave like K2.net 2003.

However, here's a quick tip for a sure fire way to get the loop back line drawn correctly (and nicely) each and every time.

  1. First move the start of the line to the left or right of the activity box.  You need to see the hand icon appear before you can move the start of the line.
  2. Next click and hold down the mouse button after you select the end of the line (i.e. the part with the arrow head).  Same as before, you need to see the hand icon appear before you can do this.
  3. Now just drag the arrow head back to the centre of the activity box.

Now once you have done this, you will notice that it drags a nice loop back from the side of the activity box back to the top of the activity box.  You can try this a few times and the behaviour is always consistent.

Easy Peasy, right? :)

Posted by johnny | 0 Comments

Differences between "Plan just once" and "Plan per destination"

There are some of us who come from a K2.net 2003 background and we tend to bring the concepts of K2.net 2003 destination rules and Destination Queues along with us when we use K2 blackpearl.  I was no exception to this.

However, while having a discussion with some of the labs guys on a feature request, I discovered my understanding of how slots and the various destination rule options work was totally wrong!

Yes, K2 blackpearl and K2.net 2003 destination rules work quite differently.

Take this example:

I have a client activity where I want to do a voting scenario.  I want to route it to a pool of 5 users.  I want my item to be approved when 2 of them approve it or 1 of them rejects it.

 Now in K2.net 2003, you would set 5 users into your destination rules and set 2 slots in your activity.  Now, when this activity instance is created; in the worklist table, you would see that 5 records in the worklist table will get created (i.e. one for each user).  As soon as the first two users action on their workitems, the other 3 workitems in the other 3 user's worklist will get expired.  Now, that isn't too efficient if the number of users increases in the destination pool.  e.g. a call center can have maybe a 100 operators serving workitems.  Of course in K2.net 2003, there is a way to work around it by using the optimization for the destination queues.  This allows you to create a single entry in the worklist table for a destination queue.  So in the worklist table, you would see that the item is assigned to the queue name instead of the user name.  The item will be assigned at the point where the first user picks up the workitem.

Now in K2 blackpearl, if you have the same scenario.  This varies depending on which option is being used in the client event options.

Plan Just Once - This option instantiates only one activity instance regardless of the number of slots.

So it would look something like this.

ActivityInstanceDest 1

         |____  Slot 1

         |____  Slot 2

Note that as there is only one activity instance, any events in the activity will only fire once regardless of the number of slots.

So you will note that you cannot:

  1. Assign the destination user in the notification email.
  2. You cannot get the User and Action Result properties from the ActivityInstanceDest object.

The whole reason here is that events and succeeding rule in the activity instance will only fire once.  So the results of the users are actually stored in the slots collection.  However, what is interesting is that there is intelligence in the succeeding rule logic.  If you have your succeeding rules to complete if 2 or more slots approve or at least one slot rejects.  The succeeding rule will fire as soon as 2 of the slots have Action Result = Approve or 1 slot has Action Result = Reject.  Note that for the "Plan Just Once" option, the succeeding rule will always fire the SetSucceedingRuleTrue handler in the code for the Succeeding Rule.  The SetSucceedingRuleFalse handler will never fire.

Plan Per Destination - This option instantiates one activity instance per slot.

So it would look something like this.

ActivityInstanceDest 1

         |____  Slot 1

ActivityInstanceDest 2

         |____  Slot 2

Note in this case, any events in the activity will only fire based on the number of instances (in this case it is 2).  Also there is a one to one relationship between the ActInstDest and SlotInstance objects.

So you will note that destination user in the notification email functions as expected and the the User and Action Result properties from the ActivityInstanceDest object are populated as well.

So in the same example above, if you have your succeeding rules to complete if 2 or more slots approve or at least one slot rejects.  If the first user approves, the succeeding rule will fire the first time.  However, as the succeeding rule condition has not been met, the SetSucceedingRuleFalse handler will fire first. Now if a second user either approves or rejects, the succeeding rule will fire again.  This time the SetSucceedingRuleTrue handler will fire.

Last Thoughts

Now after digesting all this, you can probably see that there is a performance benefit in K2 blackpearl when dealing with large number of users.  For a destination rule pointing to a hundred users while working on a activity with 2 slots.  Only two slot records get created versus 100 worklist records in K2.net 2003.  User resolve their worklist at runtime and slots are assigned to users in real-time as well.  Isn't this great?  :)

Posted by johnny | 0 Comments

0807 Early Impressions

[Updated 1 Aug 2008] 

Been trying out the early betas of 0807 and I must say there are a couple of pleasing changes from 0803.

  1. K2 reports - improvement in performance overall due to moving the paging/filtering from the web server end to the database backend.
  2. K2 Workspace
    1. Permissions listing has been enhanced.  Columns can now be sorted ascending or descending.
    2. Enhanced dialog for adding user/group permissions
    3. Workspace Node 
      • Additional setting for the workspace to control the display items per page for users.
    4. User Managers Node 
      • Additional setting to specify the limit for the number of users returned for the URM service.  Default is 100.
      • Additional place to add other trusted domains for users. -> No more fudging in the database.
      • Additional options in the UI to resolve nested groups and also other AD query related settings. -> No more fudging in the database.
  3. K2 designer for Visual Studio
    1. Much improved memory usage - I was able to create up a process with 100+ activities and memory consumption was slight above 600MB.  Nice!
    2. Wizards are also a lot zippier.
  4. Out of Office feature is now in
    1. The cool thing is that it uses the delegation feature.  So the workitems can be seen on both your worklist and your delegate.  You can even have a couple of people to be your delegate.
    2. Out of office settings can be managed by users directly from the worklist or by the administrator from the management console.  Very nice!
  5. Installer has a number of improvements - The one I like is that it now creates the SPNs on the FQDN name of the K2 farm now.  Nice!

There's probably a ton of other fixes and enhancements as well but these are the more noticeable improvements just from playing around with it for a few days.

Posted by johnny | 0 Comments

Updating Batch Action/Outcome results back into InfoPath form

I got posed this question the other day and I thought this might be useful to share.

The scenario is that when do a batch selection or quick approval action from the worklist, the outcome is not recorded into the form's audit history.  Of course, the process audit history will have it but in certain cases, the user does not have access to the process history information.

So if we wanted to store the outcome in the InfoPath form data, basically we have to update the value directly within the succeeding rules of the client activity.

Here's an example. Edit the code of your succeedin rule.  You can get the final outcome by putting this snippet of code inside the succeeding rule.  See portions in red.  The text in green is the variables you need to change to your own form and namespace.

  using System.Xml;

        public void Main(Project_282cb15964ee4ab397715563ff6641a6.SucceedingRuleContext_369ef228d5e54527b7116b0583eabd22 K2)

        {

            if (SucceedingRuleHelper.AnyOutcomesEvaluatedSuccessfully(K2))

            {

                AllInfoPathTasksFinished(K2);

                K2.SucceedingRule = true;

                XmlDocument xmlDoc = new XmlDocument();

 

                xmlDoc.LoadXml(K2.ProcessInstance.XmlFields["TestForm"].Value);

 

                XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xmlDoc.NameTable);

 

                namespaceManager.AddNamespace("my", xmlDoc.DocumentElement.GetNamespaceOfPrefix("my"));

 

                xmlDoc.SelectSingleNode("my:myFields/my:myDataField", namespaceManager).InnerText = K2.ActivityInstance.DataFields["Outcome"].Value.ToString();

 

                K2.ProcessInstance.XmlFields["TestForm"].Value = xmlDoc.OuterXml;

 

            }

            else

            {

                InfoPathTaskFinished(K2);

                K2.SucceedingRule = false;

            }

        }

 

Addendum:

If you are using the "Plan Just Once" option, you should note that there is only one Activity Instance created with 1 or more slots tied to it (See my article on this).  So if you want to enumerate through the list of actions, here's a code snippet to do this.

            for (int i = 0; i < K2.ActivityInstanceDestination.ActivityInstance.WorklistSlots.Count; i++)

            {

                Console.WriteLine("Action Result: " + K2.ActivityInstanceDestination.ActivityInstance.WorklistSlots[i].DataFields["Action Result"].Value.ToString());

                Console.WriteLine("Destination User: " + K2.ActivityInstanceDestination.ActivityInstance.WorklistSlots[i].User.Name.ToString());

            }

 

Posted by johnny | 3 Comments

Upgrading from SP1 installation with non-standard paths to 0803

Tried this out with a customer over the past 2 days where we were trying to do an upgrade for a 2 node K2 server farm (K2 Host Server and Workspace together) with a SQL cluster backend.

Typically if the installation is done on a standard path configuration, it should go pretty smooth.  However, the caveat here was that they installed SP1 on E: drive.

This causes the following issues:

  1. After running the installer, the configuration manager does not start automatically.
  2. If you try to run the configuration manager manually, the configuration manager thinks it is a new setup and will prompt you to install everything afresh.

To get around this, you need to do the following:

  1. Modify the configuration.config file in E:\Program Files\K2 blackpearl\Configuration.  Note the following connection string inside.  You need to modify localhost to the correct database server name.
    • <add key="connectionString" value="server=localhost;database=hostserver;integrated security=sspi;" />
  2. Re-run the configuration manager manually.
  3. Now it will run the upgrade process instead of installing new databases.

Now there's one more issue here that you need to take note of.  Due to the path issue, the upgrader doesn't run the SQL update scripts correctly.  This means that after the configuration manager finishes, the K2 databases are still not upgraded.  You can check the database version number from the K2Server database in the _Setting table. The version field should be 4.7285.1.0 (SP1).

At this point do not panic!  There is a workaround to fix this by manually running the database upgrade scripts in the SQL Management Studio.

These scripts can be found in E:\Program Files\K2 blackpearl\Configuration\Script.  However, you will need to do a bit of search and replace in some of these files before you can run them.

Make a copy of the following 6 files before modifying them.

  1. HostServerAlter.sql - (with relevant placeholders replaced like)
    • [NETBIOSNAME]
    • [NETLDAP]
  2. K2ServerAlter.sql
  3. K2ServerLogAlter.sql
  4. HostServerReconfigure.sql – (with relevant placeholders replaced like)
    • [NETBIOSNAME]
    • [NETLDAP]
    • [K2SQLUMDBSQLSERVER]
    • [K2SQLUMDBNAME]
  5. K2Reconfigure.sql – (with relevant placeholders replaced like)
    • [LBHOSTSERVERNAME]
    • [HOSTSERVERPORT]
    • [ADMINUSER]
    • [USERSNAME]
  6. K2LogReconfigure.sql

Note the subitems are the tags to be replaced.  The values can be obtained from the HostServer database in the Configuration table.

One final point here.  Before doing any upgrade, do a full backup of the servers and also the databases (shut down the K2 servers on both nodes before doing the backup).

This will give you the peace of mind that you can always roll back if something doesn't go right. 

 I hope this makes it easier for anybody trying to do an upgrade from SP1 to 0803 where they install in non-default paths.

Posted by johnny | 0 Comments

Tip of the Day: Freeing up memory used in K2 Designer for Visual Studio

During the course of designing a process and running the designer for a while (I am using build 0803), you might find that your designer is taking up a lot of memory. Sometimes you would normally close and reopen the designer to start afresh.

However, note that you can try this trick where you can minimize the window and your devenv.exe process memory usage should drop dramatically.  My process memory usage dropped from 200-300MB to 20MB.

Hope some of you will find this useful.  Cheers!

Posted by johnny | 0 Comments
Filed under:

Kerberos and your MOSS setup

Setting up the K2 MOSS components on your MOSS server is typically an easy task as the install is mostly non-dependant on other components (i.e. Workspace, Reports or Host Server).  However, it can be difficult to troubleshoot if you didn't setup the base requirements needed for the install.

Here's my checklist of things to do before you run the installer.

  1. MOSS needs to be installed as a complete install (if it is a standalone server).  Reason being...
  2. You need to install and configure a Shared Service Provider (SSP).  If you did not do a full install, you won't be able to configure the SSP as the SSP needs an index server.
  3. Create up the default site collection.
  4. Make sure all sites are using Kerberos for authentication.  This can be configured when creating the sites or from the central admin page under authentication providers (post configuration).
  5. Step 4 is just one part of enabling Kerberos.  You need to configure the service accounts for the app pool.
  6. You need to give the app pool account proper IIS rights.  This can be done using the aspnet_regiis -ga command.
  7. Configure the IIS sites to use Kerberos.  You can use the command from C:\inetpub\AdminScripts
    • cscript adsutil.vbs set w3svc/<IIS site ID>/NTAuthenticationProviders "Negotiate,NTLM"
  8. Configure the service account to be trusted for delegation to the HTTP SPN for the workspace runtime services and the 2 K2 SPNs for the K2 Host Server and K2 SmartObject Server.  Obviously, you also need to add the SPNs as well before you can do this.

Ok that sounds relatively simple but it can be messy if you are doing this for the first time.  You have to figure out whether you are configuring the SSP on a new site using a different port or host header.  You need to create new app pools.  You need to start up the search services required to configure the SSP, etc.  I think you get the idea.

Also on post-installation, you have some stuff to do.  In a nutshell:

  1. Deploy the K2 worklist webpart package.  If needed, populate the web part gallery for new site collections.  Once this is done, you can add the webpart to your MOSS pages.
  2. Go to central admin page under the K2 admin tab, activate the K2 features that you need.
  3. Same page, you can also add the K2 service account to have site admin rights. This is needed if your K2 server needs to create sites, manage documents, etc.

One interesting thing I encountered today was that I had the assumption that configuring Kerberos on the site collection was sufficient to get the K2 worklist webpart to work using Kerberos.  Did everything to the dot and it just refused to work.  Turned on Kerberos logging and I got zero error messages relating to the failed connection (it comes in as anonymous).  So what gives?

After a lot of double checking and thinking, I finally tried configuring the SSP to use Kerberos instead of NTLM.  Rebooted the server and happily the K2 worklist webpart starting connecting correctly using Kerberos.

 So lesson learnt here today, always start off with Kerberos for all MOSS sites (including SSPs) if you are planning to use them with your K2 distributed environment.  I hope the steps I provided helps anybody who is having issues with their own K2 MOSS setup.

Posted by johnny | 3 Comments

Distributed Install differences with Build 0803 [Part II]

I was involved in a distributed installation on a new x64 environment today and there were some interesting behaviour which might be useful to share.

This environment was configured as such:

Server A - Workspace/K2 Host Server

Server B - Database and Reporting Services

We were using virtual names for the K2 workspace, the K2 server farm and also the K2 database server.

e.g. My servers can be called ServerA and ServerB.  My web cluster can be called k2web.k2.com.  My K2 server farm is  k2app.k2.com and my K2 database server is k2db.k2.com.

Ok now the interesting thing is that my servers are joined to the intranet domain called k2.local.  So all these conditions posed some interesting configuration steps for the 0803 installer.

  1. The installer expects the server farm name to have the k2.local domain path.  Otherwise it won't let you continue.  It expects the farm to be called k2app.k2.local.  If you type k2app.k2.com, the validation check prevents you from continuing.
  2. For the K2 reports install, the Test connection fails even if you set the SPN for HTTP/k2web.k2.com, the K2 server SPNs and the other required steps (See my earlier post).

Now here's how to get around this.

For the first issue:

  1. Install with the k2app.k2.local path for the server farm first (Don't worry at this point).  Complete the install.
  2. Now go to the SQL Server Management Studio on the database server.  Open up the HostServer database and open up the Configuration table.  Modify the LBHOSTSERVER entry to the server farm name that you want.  In this case it is k2app.k2.com.
  3. Now re-run the configuration manager and select the Reconfigure option.
  4. You will now notice that the proper domain path is populated for the K2 server farm name.
  5. Finish the reconfiguration and reboot.
  6. Now there's a couple of things that needs to be manually updated before this works.
  7. In each K2 server, check the following:
    1. Run the BrokerManagement.exe from C:\Program Files\K2 blackpearl\ServiceBroker folder.
    2. Select Configure Services.
    3. Now there's a couple of service instances that are impacted by the path but there is one that is not updated by the reconfiguration
    4. Look for the SourceCode.SmartObjects.Services.UserRoleManagerService.URMService service type.
    5. Expand the sub node tree. Right click and select Configure Service for the single instance under it.
    6. Check the HostServerConnectionString field and check the Value field.  The connection string should be pointing to the old path (i.e. k2app.k2.local), change the cluster path to the one that you want (i.e. k2app.k2.com).
    7. Click Save and it will refresh the service instance.
  8. One more setting needs to be changed here on the database server.
    1. Go to the database server, open up SQL Server Management Studio.
    2. Navigate to the K2Server database.  Open up the _Setting table.
    3. Modify the UMData field.  The Value contains the connection string.  Modify it to correct the cluster path (i.e. k2app.k2.com).
    4. Save and exit.
  9. Now restart your K2 servers (you can start them in console mode using the service account credentials [Runas]).
  10. And hey presto!  You now have the server farm name that you want!

For the second issue:

  1. Note the the test connection assumes that it will be connecting with the local server name and the machine domain.  So in essence, it is testing the connection with the request for the SPN HTTP/ServerB.k2.local.  However, you have only set the SPN HTTP/k2db.k2.com.  Obviously they don't match so the test will fail and prevent you from continuing.
  2. To fix this, temporarily add the SPN HTTP/ServerB.k2.local to the reporting services app pool account.
  3. Now click the Test Connection button.  You should notice that instead of immediately popping up an error, it takes a while as it discovers that the connection can be made and it attempts to validate the RS setup.  If it fails, you probably have misconfigured something else, I would turn on kerberos logging and troubleshoot at this point.
  4. If the test succeeds as expected, you are in business.  Complete the install.
  5. Now once the install is done, you can remove the temporary SPN that was created using the setspn -D option.
  6. Test your reports from workspace to verify that everything is working fine.

I hope this 2 little bits of information will help all those out there who are doing distributed installs that can scale out in the future.

Cheers!

Posted by johnny | 0 Comments

Distributed Install differences with Build 0803

We have been having an interesting week trying out the new 0803 install on a distributed install.

The reason being is that there is a subtle change in the K2 reports installation.  Previously in SP1, you would install the reports using the logged on user credentials so basically the reports would get created (as built-in administrators are content managers).  However, many people normally would miss out the post-configuration step of setting the content manager rights for the K2 workspace account.  This is needed by the report designer module.

In Build 0803, this has been changed to force you to check that the K2 workspace account has the rights before you can install the K2 reports.  There is an additional two fields to specify the K2 workspace account ID and password.  On first try, clicking on test connection normally generates a connection failure.  So what gives?

 After a lot of digging from the team and also support from the labs team, we discovered that the checking mechanism does a kerberos connection to the reporting services site using the K2 workspace credentials.  So basically what was missing was the kerberos delegation trust.

To get it working, we did the following:

  1. Configure the K2HostServer and K2Server SPNs on the K2 service account as per the K2 documentation.  Look for setspn in the help or see my earlier blog entry on the distributed setup.
  2. Created the K2 workspace app pool account before hand.
  3. In AD Users and Computers, on the K2 workspace account delegation tab, gave it rights to trust the 2 K2 server SPNs created in step 1.
  4. Configured the Reporting Services site to use a RS service account.
  5. Configured the RS service account to have proper IIS rights.  You can use the following command.  aspnet_regiis -ga <domain>\<RS account>
  6. Configure the RS site to use kerberos.  You can open a command prompt and navigate to the C:\Inetpub\AdminScripts directory and run the following command.  cscript adsutil.vbs set w3svc/<RS Site ID>/NTAuthenticationProviders "Negotiate,NTLM" . Replace the <RS Site ID> tag with the IIS site number from the IIS Manager.
  7. Once you have this done, go back to the configuration manager and test the connection again.  It should work at this point.
  8. Note that once the configuration completes, you will see a message saying that it completed with errors.  If you look at the logs, it will say that it couldn't find the workspace folder.  This is a benign error and can be ignored.  The K2 reports will not be affected by this.

If it still doesn't work after step 7, there could be something that is misconfigured.  The best bet at this point is to turn on kerberos event logging and troubleshoot from there.

I hope this little tidbit of information will help all those out there who are trying to get the distributed installs working with 0803.

Posted by johnny | 0 Comments

Build 0803 First Impressions

As many of you may know, K2 [blackpearl] Build 0803 has been released.  The naming convention ties in more closely to the targeted release date (i.e. Year-Month) and this will be the main naming convention moving forward for new releases.

Key highlights of this release:

  • 64-bit support - Support for x64 architectures but not IA64 (which is probably not important).
  • Internationalization support - improved compability in installing in non-English platforms.  Now with better localization support.  This will be the platform in which future language localizations will be based off.
  • K2 license management improvements - Mangement console now allows you to manage the user licenses being consumed and also allows you to reset the user count as needed.
  • Various Installer enhancements - I noted the following enhancements from seeing various people trying the new installer:
    • When upgrading, K2 service is stopped automatically now (previously had to be done manually).
    • K2 Service rights to start as a service is now added automatically.
    • You can test the reporting services connection via a new "Test" button.
  • Various Performance Enhancements - SmartObject, Host Server, Workspace.  I personally have tried the new workspace and I have found it a lot zippier when enumerating the category folders.
  • IPC Event fixes - Should only impact you if you IPC events to call child processes.
  • Greatly enhanced documentation - The documentation files are now back in CHM format so you could essentially rip them out and use them as a local reference on another machine.  The SDK references have also been beefed up over the past versions.

Overall, this is a very nice release and is a big step in the maturity of the product as a platform for building applications.

 If you spot anything new and want to share, feel free to post in your comments.  Cheers.

Posted by johnny | 0 Comments

Host Server Performance Tweaks for K2 [blackpearl] SP1 and earlier

Just some small tips here to help boost the performance of the Host Server.

In the following config files in C:\Program Files\K2 blackpearl\Host Server\Bin

  • DependancyService.config
  • SourceCode.Categories.Runtime.config
  • SourceCode.EventBus.ClientRecorder.dll.config
  • SourceCode.Workflow.Runtime.Management.config
  • SourceCode.Workspace.Runtime.config

Look for a ConnectionString key value.  This stores the SQL connection string to the database.  In the connection string, change the pooling value from False to True.

It would also be a good idea to make a backup of the config files if you don't really know what you are doing.  :)

 Restart your Host Server to get the changes to take effect.

And presto! you should see a faster Host Server. Note that this should be already fixed in the new 0803 build that should be released soon (plus a whole host of other fixes and performance enhancements).

Posted by johnny | 0 Comments

Deleting Obsolete Process Instances from a K2.net 2003 or K2 [blackpearl] database.

As you may know, deleting completed process instances is not really a out-of-the-box feature in K2.  You only have the option to delete running process instances.  The whole idea behind this is that for compliance reasons (e.g. SOX), process audit history is very important and should not be easily removed.

However in certain cases, it might be a good idea to remove certain processes from the K2 databases which are no longer needed.  This helps to reduce the size of the K2 Log database when the obsolete processes are not needed.  To achieve this end, I have written a simple stored procedure which allows you to remove all completed process instances from a K2 Log database.  This is based on the native K2 functionality which deletes the log entries when deleting a running process instance.

This stored procedure does the following:

  1. Removes the completed process instances based on the full name of the process.  e.g. "Finance\Purchase Request"
  2. Does a pre-check to ensure that there are no running process instances.  As I said, this is for obsolete processes, so there should not be any running instances.

The stored procedures are attached in the zip file for this post and there are two versions.  One for K2.net 2003 and one for K2 [blackpearl], the stored procedures have been tested on K2.net 2003 SP2a and K2 [blackpearl] SP1.  They should work for later versions as long as there are no changes in the lProcInstRemove stored procedure which is found in the K2 Log database.

Although due diligence and testing has been done to ensure there Stored Procedures work as advertised but in any case please do the proper DB backups before executing this is a live environment.

Note: These stored procedures are not supported by K2 directly and if any damages arise out of their use or incorrect use, myself and K2 as a company are not liable for them.  Usage of these stored procedures assumes that you have a certain level of SQL expertise so please don't cry over split milk if anything wrong occurs... :)

 I would also recommend running this when the K2 servers are offline.  This is especially true if the K2Log (K2.net 2003) or K2ServerLog (K2 [blackpearl] have a ton of records.  Executing this stored procedure on a large set of instances while the K2 server is running might cause deadlocks or timeouts to occur.

You might want to also run a DBCC SHRINKDATABASE command to reclaim execessive unused space once the obsolete process instances are removed.

I hope some of you will find this useful.  Cheers.

Posted by johnny | 1 Comments

Attachment(s): DeleteProcessInstances.zip

Handling Multiple Documents in the K2 [blackpearl SharePoint Document Template

This was a nice tip sent to me by one of our Technical Specialists (CY).  Enjoy!

 

---------------------------------------------------------------------------------------------------------------------------------------------------

 

   In BP, using the SharePoint Document Template, various functions are supported, this include uploading and downloading documents (multiple documents in advanced mode), check-in, check-out, updating of metadata, etc etc.

 

   The challenge here is if you need to do this for multiple documents (e.g check-in and check-out) how do you do it? The functionality is not out of the box (verified with labs) but that doesn’t mean it cannot be achieved. This applies to all functionalities in the Document Template Wizard, including uploading, downloading, and updating of metadata, undo check out, check-in and check out.

 

1.       Create the document wizard functionality. In this example I will be doing recursive check in of documents based on a Process Data Field (FileName) passed in. The value stores the documents I want to check in and the separator “;” is used to distinguished the various file names. For example: “doc1.pdf;doc2.pdf”

2.       Go to code view of the event and make the changes to the code as follows. The yellow portion highlights the changes needed:

foreach (XmlNode checkInItem in checkInItems)

                {

                    foreach (string docName in K2.ProcessInstance.DataFields["FileName"].Value.ToString().Split(';'))

                    {

                                if (bool.Parse(checkInItem.SelectSingleNode("UsePartOfProcessItems").InnerText))

                            {

                                                ….

                                                checkInSet += "<DocumentName>" + docName + "</DocumentName>";

                                                ….          

                                }

                                else

                                {

                                                ….

                                                checkInSet += "<DocumentName>" + docName + "</DocumentName>";

                                                ….          

                                }

 

                                     }

                }

 

Posted by johnny | 0 Comments

K2 [blackpearl] HF2.01 Distributed Installations (and also SP1)

I have doing quite a few distributed deployments for customers in the APAC region and I thought it would be nice to share my experience and tips with the community as there are several challenges when the reporting services web server is on a separate machine from the K2 server.  The tips below assume that:

  • Visual Studio is not installed (which is normally the case for secure environments)
  • K2 Workspace is installed with the K2 server.
  • Installations are all done to the default program file paths.  If you use other drive letters, there might be some additional configuration for HF2.01. i.e. Some assemblies need to be copied to C: drive.  I have tested this with SP1 and it is not needed.

Note some of the steps might not be needed when K2 [blackpearl] SP1 is out.

Quickstart Guide for Distributed Installs

  1.  Make sure the base pre-requisites are set up correctly first for the Windows Server 2003 Machines.
    • Windows Installer 3.0 Redistributable
    • Microsoft Report Viewer Redistributable 2005 SP1 - Make sure it's SP1!  It's pretty hard to tell as MS doesn't have any indication other than the difference in size of the setup files.
    • Windows 2003 SP2 
    • .NET Framework 2.0
    • .NET Framework 3.0
  2. Create your K2 service account and also the K2 workspace app pool account in your domain.  Give the K2 service account local admin rights to the server and "Log on as a service" rights in the local security policy console.  Give the K2 workspace app pool account IIS_WPG group rights.
  3. Using the Component Services Management console, configure the MSDTC security configuration of both the SQL Server and the K2 Server nodes to use the following settings:
    • Check "Network DTC Access"
    • Check "Allow Remote Clients"
    • "Allow Remote Administration" was not needed so I left it as unchecked.
    • Check "Allow Inbound" and "Allow Outbound"
    • For a cluster, set the authentication to use "Incoming Caller Authentication Required".  Mutual Authentication is not supported in a cluster configuration.
    • Enable TIP and XA transactions was left unchecked as we were not using internet transactions or transactions to Oracle or DB2.
    • DTC Logon Account *must* be left as NetworkService.  This is recommended by MS.
  4. If you have plans to setup as a cluster, make sure to setup as a Farm configuration.  This is true even if you only have one node at the moment.  If you set it up as a stand alone server, you might face issues later in migrating.  This means, for pre-requisites:
    • You need to configure the virtual DNS entry for the cluster first.
    • If you are setting up 2 K2 server nodes or more, make sure NLB is configured right first.  If NLB is not configured first, the K2 Host Server service will not start properly.
    • Kerberos configuration is mandatory.  This is true even if the K2 workspace is installed together with the K2 Host Server service.  This is different from K2.net 2003 due to the Farm mechanism used.  i.e. you have to specify the farm fully qualified domain name (FQDN) up front in the K2 configuration manager.  See below for the actual Kerberos configuration details.  NTLM can be used only in a stand alone server configuration.
  5. Install the first server node first, follow the setup guide for details.  Just make sure you specify the virtual cluster name correctly as the default value is left as the domain path only.  e.g. contoso.com instead of k2cluster.contoso.com.  Specify the database details.  Note you will need your license key here.  Reboot as needed.
  6. Run the HF2.01 update.  This will change with SP1 as it is a full install.
  7. Install the second server node next.  Select Add server to farm option.  Point it to the correct database.  Note you will need your license key here.  Update with HF2.01 next.    Reboot as needed.
  8. Ok at this point, your server should not start correctly.  If you launch it in console mode, you will see that the workflow server is waiting for the SmartObject server thread to start.  This is normal as Kerberos has not been configured yet.  I'll leave the Kerberos configuration to the end so let's do the Reports setup next.
  9. One thing I noted is that try not to change the default virtual folder names of the Reporting Services web sites.  I noted this can cause the K2 overview reports to not install properly.  In SP1, they are introducing the ability to specify the path of the Reporting Service web service virtual folder.
  10. Before running the installer, warm up the RS web site by navigating to http://<rs_server_name>/reports.  This helps prevents timeout errors during the installation. 
  11. On your reporting services web server, run the K2 installer and configuration manager.  This will detect the RS installation and install the K2 Reports component.  Update with HF2.01 as needed.  Reboot as needed.
  12. There is some post configuration needed at this point with HF2.01.  Copy the following assemblies to the GAC.  Copy it from another machine or VPC as needed.  Note that this is fixed in SP1 and this step is not needed if you are using SP1.
    • SourceCode.Data.SmartObjects.Client
    • SourceCode.SmartObjects.Client.dll
    • SourceCode.SmartObjects.Management.dll
    • SourceCode.Categories.Client.dll
    • SourceCode.HostClientAPI.dll
  13. Copy the following dlls to the RS bin folder C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin.  Note you do not need to do this for SP1.
    • SourceCode.Data.SmartObjects.Client
    • SourceCode.SmartObjects.Management.dll
  14. Check that the following lines are in the RSReportDesigner.config.  They were already there in my setup but somebody said it wasn't in theirs for other installations.  Note this is not needed for SP1.
    • <Configuration> 
        <Extensions>  
          <Data>
              <Extension Name="SOURCECODE" Type="SourceCode.Data.SmartObjectsClient.SOConnection,SourceCode.Data.SmartObjectsClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=16A2C5AAAA1B130D"/>
          </Data>
          <Designer>
              <Extension Name="SOURCECODE" Type="Microsoft.ReportingServices.QueryDesigners.GenericQueryDesigner,Microsoft.ReportingServices.QueryDesigners"/>
          </Designer>
        </Extensions>
      </Configuration>
  15. Also check for the rsreportserver.config.  Note I didn't have to add this (This also was not needed for SP1).
    • <Configuration> 
       <Extensions>  
        <Data>
         <Extension Name="SOURCECODE"                                     
                             Type="SourceCode.Data.SmartObjectsClient.SOConnection,
                             SourceCode.Data.SmartObjectsClient, Version=4.0.0.0,   
                             Culture=neutral, PublicKeyToken=16a2c5aaaa1b130d"/>
        </Data> 
       </Extensions>
      </Configuration>
  16. Also check for the rssrvpolicy.config.  Note I didn't have to add this (This was also not needed for SP1).
    • <CodeGroup  
      Description= "Code group for the Custom Data Extension"  
      Name="CustomDataExtensionCodeGroup"
      PermissionSetName="FullTrust">
      class="UnionCodeGroup”
      version="1"         
        <IMembershipCondition
                Url="C:\Program Files\Microsoft SQL Server\MSSQL.1\Reporting 
                Services\ReportServer\bin\SourceCode.Data.SmartObjectsClient.dll"/>
                class="UrlMembershipCondition"
                version="1"
      </CodeGroup>
  17. Note the Reporting Services Web server has 2 virtual folders that run under the Network Service account, to get kerberos working, create a RS App Pool account and give it IIS_WPG rights on the RS web server.  Set both app pools for the RS web application to use this account. 
  18. Give reporting services content manager rights to the K2 workspace app pool account.
  19. Now comes the interesting part of doing the Kerberos configuration.  Here's my setup for a Win2k domain or mixed mode Win2K3 domain  (i.e. non-constrained delegation):
    1. SPNs setup.  Note the last 2 (i.e. SCHostServer) was not needed in my setup but another person mentioned that it was needed.  I would leave it out unless you hit issues.  Also note that the K2Server SPN is set with both the port number and without.  I discovered this was needed, otherwise you would get kerberos errors.  Also note the need of the port number on the BlackpearlServer SPN, this is needed otherwise your K2 Host server service will not start.
      • Setspn –a K2Server\<K2 Server cluster FQDN Name> <Domain>\<K2 Service Account Name>
      • Setspn –a K2Server\<K2 Server cluster Netbios Name> <Domain>\<K2 Service Account Name>
      • Setspn –a K2Server\<K2 Server cluster FQDN Name>:5252 <Domain>\<K2 Service Account Name>
      • Setspn –a K2Server\<K2 Server cluster Netbios Name>:5252 <Domain>\<K2 Service Account Name>
      • Setspn –a BlackPearlServer\<K2 Server cluster FQDN Name>:5555 <Domain>\<K2 Service Account Name>
      • Setspn –a BlackPearlServer \<K2 Server cluster Netbios Name>:5555 <Domain>\<K2 Service Account Name>
      • Setspn –a HTTP\<K2 Workspace cluster FQDN Name> <Domain>\<K2 Workspace App Pool Account Name>
      • Setspn –a HTTP\<K2 Workspace cluster Netbios Name> <Domain>\<K2 Workspace App Pool Account Name>
      • Setspn –a HTTP\<Reporting Services FQDN Name> <Domain>\<RS Web App Pool Account Name>
      • Setspn –a HTTP\<Reporting Services Host Name> <Domain>\<RS Web App Pool Account Name>
      • Setspn –a SCHostServer/<K2 Server cluster FQDN Name> <Domain>\<K2 Service Account Name>
      • Setspn –a SCHostServer/<K2 Server cluster Netbios Name> <Domain>\<K2 Service Account Name>
        1. Take note with K2 [blackpearl] SP1, the SPN service name for BlackPearlServer (and SCHostServer) are changed to K2HostServer.
    2. Configure the accounts to be trusted for delegation.  Use the AD Users and Computers management console.  It is a checkbox in the account properties when the AD is in Win2K mode or Win2K3 mixed mode.  Check for the following accounts:
      1. K2 Workspace App Pool Account.  If you are using Win2K3 Native mode, you can use constrained delegation, set the following trust on this account:
        • Trust HTTP\<Reporting Services Name> SPN on RS Web App Pool Account
        • Trust BlackPearlServer\<K2 Server Name>:5555 SPN on K2 Service Account
        • Trust K2Server\<K2 Server Name> SPN on <K2 Service Account Name>
        • Trust K2Server\<K2 Server Name>:5252 SPN on <K2 Service Account Name>
        • Trust  SCHostServer SPN on <K2 Service Account Name>  - Note this last one was added by another person, I did not have to do this in my own setup.
        • Note in SP1, SCHostServer and BlackPearlServer should be replaced by K2HostServer
      2. RS Web App Pool Account.  If you are using Win2K3 Native mode, you can use constrained delegation, set the following trust on this account:
        • Trust BlackPearlServer\<K2 Server Name>:5555 SPN on K2 Service Account
        • Note in SP1, BlackPearlServer should be replaced by K2HostServer

Ok, that's it, if everything is done right.  You can start up the K2 services (or reboot the K2 servers) and they should now run fine.  If they don't, I would normally start troubleshooting by turning on Kerberos Logging (http://support.microsoft.com/kb/262177) and the event log for errors.  They will give you clues if you missed a step.

Also note that if your kerberos configuration is done correctly, you will be able to see a standard reports node in the K2 public folders tree in the K2 workspace.  Test by opening up the Process Overview reports and see if it runs fine.  If you do not see them, I would probably first check the K2 configuration log files for errors.  This might give some clues on installation issues.

Hope you all find this article useful.  Cheers!

Posted by johnny | 1 Comments
More Posts Next page »