K2 blackpoint Q&A at MOSSIG

Was a great turnout for MOSSIG tonight – to see the demo+prezzo by Jey Srikantha from jEyLaBs.

Jey covered much of the functionality of K2 blackpoint; there’s just soooo much involved, that it’s tricky to show it all in detail.

Just as a quick overview of what was shown :

  • K2 Web Designer – add a new process, and use a “template” of Approve, Decline, Re-Work – and include some events & user tasks (uses a Silverlight plug-in)
  • K2 Studio – rich-client (desktop) which includes additional designer templates in an Office-2007 style designer
  • K2 Process Portals – SharePoint webparts & site templates for managing the processes deployed within K2 blackpoint. 
  • K2 Worklist + ViewFlow – user interaction and reporting views

While I’d seen much of the functionality already, but was good to see/hear the reaction from attendees – and there were lots of questions.

I wanted to provide a further “take” on the whole blackpoint/blackpearl equation – and “document” some of the questions+answers…>

What is blackpoint and what is blackpearl ?

One of the analogies I like to use (for developers) is the “Visual Studio” approach.   Firstly, think of Visual Studio Express, and then Visual Studio Professional.  Each of these products have a bunch of project-types & functionality that you create.  

And – while the projects you can create in “Express” is limited, you can easily upgrade to “Professional” – and open the same projects and continue – with more features & functions.

The analogy here is :

  • K2 blackpoint is akin to Visual Studio Express
  • K2 blackpearl is akin to Visual Studio Professional

Another way to say it – is that one is a subset – and the other is the super-set :

image

Can you include code / is there an API / can you add new activities ?

Some of the discussion related to being able to start workflows via code, or being able to add new activities to the designer, and so forth.  

In essence, what’s the “extensibility” level of K2 blackpoint ?    (for developers)

Much of the answer was simply “uuum, No – you’d need K2 blackpearl for that”.  

And yes, sorry to disappoint, but the K2 blackpoint product is intended to provide a huge wealth of functionality for SharePoint workflow – that doesn’t NEED to delve into any code – and there’s a LOT you can do within the bounds of the functionality.

If you need to “outgrow” the bounds of what K2 blackpoint can provide, then you may need to consider looking at K2 blackpearl instead.

Just like the analogy of Visual Studio – the different versions of the product have different inclusions – eg. if you need Source Code control, you need to use “Professional” instead of “Express”

What’s the upgrade path ?

As above, there (will be) the ability to simply do an in-place upgrade from K2 blackpoint to K2 blackpearl.   This will mean that the new features of “pearl” will be immediately available.  This includes the following :

  • Licensing upgrade – the principle is that this will be a simply “license key” change.  Obviously there will be some licensing fees involved – this can be determined on a case-by-case basis from K2.
  • Installation upgrade – in principle (again), this will be a simple “SETUP.EXE” installation.   At present, this is not really an option – until the K2 blackpearl product has a minor update to include the K2 Studio, K2 Silverlight Designer and K2 Process Portals.  This is expected very soon – the latest I’d heard is that there is a BETA release due in April (ie. next month).  This will also support the 2008 stack (Windows Server 2008, SQL Server 2008 – and Visual Studio 2008) – will be a big release indeed !

=======================

If there are any other questions/comments about the session at MOSSIG – or K2 blackpoint in general, pls. feel free to enter a comment…>

Click here to see some more info :

=======================

Thanks Jey for tonight’s session at MOSSIG…!

:-)

K2 WorkList Item Email – How To Change The Mail Template

With K2, there is (most likely) the need to create a user task – ie. a client event of some kind – using InfoPath, ASP.NET, etc. 

And – all you have to do is tick a box and an email will automatically be sent to the user when the task (client event) is created.

-1

When the user task happens, the user will then get an email looking like this :

0

But – if you need to (or want to) CHANGE the look and feel of the email template – how can I does this ??    Well, I’m glad you asked…>

:-)

Deep (deep) within the bowels of the K2 “Program Files” folder, there are a number of EXE’s and CONFIG files – and there’s also a file called…     (take a deep breath !) :

SourceCode.EventBus.ClientRecorder.DLL.mailTemplate

*phew*

The file location is :

C:\Program Files\K2 blackpearl\Host Server\Bin\

This file contains the HTML definition of what that email looks like (above).   And so – you can use your favourite HTML editor to change it all about – I just fiddle away in Visual Studio – the one tool of choice for me…

Quick tip – append a “.HTML” extension and will then have a proper editing experience in Visual Studio – colour coded & preview – just need to fix up some XHTML.

And – make sure you remember to remove the “.HTML” when you’re completed.

Here’s one I’ve prepared for the “DENALLIX” corporation (seen in Visual Studio) :

1

IMPORTANT – be sure you take a backup copy of the file – and you MUST retain the value within the text : [UrlWithSN]    This is replaced with the URL to the client event page – ie. an ASPX / Forms Server page.

After saving the file in place with the new layout & so forth – all is done for the template. 

Time to give it a whirl.

  • So – users should see this new layout from now on, right ??    WRONG
  • Just a simple re-start of the K2 Server should pick it up, eh ??   WRONG
  • Re-boot the server (Windows & all) – should pick it up, eh ??   WRONG

Jeez – what do I have to do to use my new mail template !!??!

In fact – this mail template is only loaded when a new client event is created in Visual Studio.  

So – any NEW processes that are developed – and deployed – will have the correct mail format.

BUT – not any process instances that already are underway – or for any new instances of an already deployed process definition.

:-(

To demonstrate the concept, I’ll create a new process (very simple) – and we’ll worry about the OTHER process mail templates a bit later (read more below).

2

  • Add a “Default Client Event” – just put something like http://www.abcdefg.com for the address – who cares, just want an email to come through.
  • Just need the default action (“Task Completed”)
  • Add a “Default Server Event (Code)” – and add in a line to complete (as above)
  • Deploy the process
  • Jump over to K2 Workspace, and start up a new instance.

3

Then – should get an email arrive – just like this :

4

That looks great, eh ?    Being HTML, you can configure anything really – including STYLE, height, layout – anything really !   

This is definitely something that you should do BEFORE creating any new K2 processes – but there’s a really clever (MacGuyver) trick for “refreshing” the existing processes that you’ve deployed.  

Meaning that you don’t have to re-edit / re-deploy them all – and any currently running instances will get the fancy new email template / layout.

This involves either of the following :

  • Use the K2 Workspace to view the email “Notification Event” to change what the format of the email will be.   This is a “manual” step – and has to be done one-by-one – I had over 80 listed on my K2 Server – and so I wanted to find an easier way
  • You can use (an unsupported) SQL Server update to “reset/update” the email templates for any “existing” processes – including those underway, and those deployed already.

But – will have to leave that for now.  I’ll detail THOSE approaches in the NEXT post…  

Server Code Event – K2 BlackPearl

One of the best aspects of K2 BlackPearl is the ability to include CODE – sometimes in response to an “event” of some kind – such as before or after an event or activity :

image

This can be either “standard C#” code – or a Windows Workflow designer “chunk”.

The example I’ll walk through is more with regard to “standard C#” code.  

Or – more specifically – using a “Default Server Event (Code)”.

Some background – and the reason behind this post.  

We have a workflow with an InfoPath form, and need the K2 process to update/inject values into the XML behind the form.  

There used to be a specific “event wizard” for this with K2.NET 2003 – but no longer, and have to use some code.  

The other aspect being covered is “re-using / re-factoring” the code into a shared module.   And calling this from within K2 – ie. an external DLL.

OK – so here’s what I’ve baked already :

  • InfoPath form – with two views – one for Submit and another for Manager
  • Very (very) basic workflow – initiated from a SharePoint forms library
  • InfoPath client event to approve/decline
  • Send an email to notify if approved/declined

image

If you’re lost already – I suggest you don’t read any further, there’s a great book that will help with some learning’s, and getting up-to-speed with K2.

Here’s what the user’s see – with the form initiated from clicking “NEW” in the document library :

image

And the manager view – with an additional field to update some information (synopsis) – not a great example, but it’ll prove the point.

image

This runs fine – but what we need to do is update the XML in the InfoPath form BEFORE it’s shown to the manager – with the “synopsis” field pre-populated – ideally using other data in the form – but just hard-coded for now.

This will be reviewed by the manager – and updated as necessary – and used in the body of the email to be sent out.

Here’s the basic steps that I’m taking to do this :

  • Within the K2 BlackPearl “solution”, add another “project” as with any other web application within Visual Studio.
  • Choose “Visual C#” – and then “Class Library”
  • Name the new class project “K2Helper”
  • Rename the class library (CS) to be “InfoPathHelper”

The solution (and projects) should NOW look something like this (click to expand/enlarge):

image

We’re going to add a method that can then be called from within the K2 project.  This will take some parameters relating to “InfoPath XML” – which will become apparent soon enough.

  • 1st step is to make sure the “using System.Xml” has been added at the top of the class
  • And then – add a method :

public static string UpdateInfoPathField(string xml, string nameSpace, string fieldName, string fieldValue)
{

}

The next set of code has been sourced / stolen / copied from my good buddy Jason Apergis – check out this post – related to “updating InfoPath fields” :

Working with InfoPath XML and Archiving it with BlackPearl and SharePoint

//Load up the XML from input parameter
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);

//Create a name space manager for InfoPath
XmlNamespaceManager nsMgr = new XmlNamespaceManager(doc.NameTable);
nsMgr.AddNamespace("my", doc.DocumentElement.GetNamespaceOfPrefix("my"));

//Now set the value for XPath
string xPath = "//my:" + nameSpace + "/my:" + fieldName;

//update the value in the XML
doc.SelectSingleNode(xPath, nsMgr).InnerText = fieldValue;

//return the "fixed" xml back as a string
return doc.OuterXml;

This is the same code – shown in the nice Visual Studio editor :

image

OK – that’s about it.  

Do a quick build of the project (just the “K2Helper” project) – and verify that all is OK.   

Now – we can turn our attention to the K2 workflow project.

  • Double-click on the KPRX file – to display the K2 workflow
  • RIght click somewhere in the white space – and select properties
  • Need to add a reference to the DLL of the project (above)

image

  • Click Add
  • Then, click Browse
  • Navigate to the BIN folder, and select the DLL – and click OK

image

Now that there is a reference to the project/DLL, we can include a reference within code – and use the method as needed.

  • Drag a “Default Server Event (Code)” onto the design pane
  • Position this ABOVE the Manager Approval step
  • Move the lines & boxes around – and join it up
  • Should look something like this :

image

Now, we can actually add the code :

  • Right-click on the “lightning bolt”

image

  • Click View Code > Event Item
  • Add the statement at the top “using K2Helper”
  • The following code then :
      • Grabs the XML
      • Passes the XPath, FieldName and Value to set
      • Set the xml BACK to the K2 XMLField – and thus the form

//Get the XML Field string
string xml = K2.ProcessInstance.XmlFields[0].Value.ToString();

//pass it to the class, and return the updated XML to the string value
xml = InfoPathHelper.UpdateInfoPathField(xml, "meetingAgenda/my:meeting", "meetingSynopsis", "Lunch will be provided");

//Now set the value back into the XML Field
K2.ProcessInstance.XmlFields[0].Value = xml;

This is the same code – shown in the nice Visual Studio editor :

image

And so, when the manager approval step is shown, there is a value that’s (magically) appeared :

image

*** Obviously – this can be extended – to grab out the fields within the form, and compile the “synopsis” of the meeting. 

Eg,   “Joe Barnes will chair the meeting to discuss Development KickOff.  Please be prompt, as the meeting will commence at 11:00 – make your way to Rm 402

The manager could then update as needed – and the TEXT would be sent in the email in the following step.

That’s about all it takes – in case there are any questions !!?!    *smile*

Here’s what was shown :

  • Default Server Event (Code) – calling to an external DLL
  • Method to update InfoPath values (thx Jason A)

Hopefully that quick overview is of some use.  

Pls. leave a comment if you would like to discuss – or to try out some more examples (if you’re NICE, I might even email you the code/project)

:-)

K2 Book is nearly out

Was a BIG effort from a dozen authors – as well as the folk at Wrox (Wiley) to produce the new “Professional K2 BlackPearl” book.

I’ve always liked the Wrox books – I first bought a SQL-2000 book, and then C#, and ASP.NET – and thumbed through some of the SharePoint offerings also.

It will be a real buzz to see the book in my hand – with my photo on the front !

They’ve updated the cover – to include ALL authors…>

ProK2Cover

(That’s me – 2nd from the left – back row)

:-)

Click here for more details – click here for Amazon, if you want to buy it.

Here’s the back cover also :

backcover

K2 blackpearl enables you to quickly build simple to very complex and dynamic process-driven applications. This definitive guide gives you the tools to evaluate, architect, deploy, and manage the K2 platform and its processes.

It takes you through everything from the market and architecture of the platform to approaching process design and developing your own custom user manager.

You’ll first gain a thorough introduction to K2 blackpearl and process-driven applications. Next you’ll dive into the architecture and installation options as well as process planning and design essentials for working with the main pieces of the platform.

You’ll then gain an administrator’s view into the software including all key aspects that you should know. And you’ll progress to more
advanced concepts and platform extensions to gain a complete picture of K2 blackpearl.

This book arms you with the greatest tips and tricks out there for working with K2 blackpearl so you can successfully transform your company into a processoriented, efficient business.

What you will learn from this book

  • The steps for identifying and designing processes
  • How to plan your development, QA/staging, and production environments
  • All about process planning and the concepts of process design
  • Ways to use the K2 Workspace for notifications, reports, assigning process permissions, and recovering from errors
  • How to build a user manager to plug into the K2 platform
  • Steps for customizing the platform and your processes to your needs
  • How to use data from SAP within your processes

Who this book is for

This book is for business users who want to gain a better understanding of K2 blackpearl as well as for developers who need details on how to effectively deploy and use this software.

Will have to put some ideas and thoughts about the NEXT book !

Updated Beta for BlackPoint (beta 2)

As if there wasn’t enough to read & play with from Microsoft and PDC (Azure, Windows 7, Office 14) – there is a new beta drop for K2 BlackPoint.

It’s now feature-complete, and the RTM should happen “this year” – or so I’m lead to believe.

One of the best aspects is that there is a take-to-market proposition for customers, with a 25% discounting if purchased prior to RTM date.

In case you’ve been living in a cave, and don’t know about BlackPoint :

K2 blackpoint software eliminates complexity and allows users to quickly build workflow solutions and process-driven applications within Microsoft Office SharePoint Server 2007 and Windows SharePoint Services 3.0

Even non-developers can use K2 blackpoint to create new SharePoint workflows that span libraries, sites, InfoPath forms, server farms and organizations; manage approvals; and route documents and list items.

With K2 blackpoint everything can be built without code, and users can assemble new applications from information that already exists and workflows that have already been built.

It’s basically the BEST tool for creating SharePoint workflows – with a bunch of wizards, reports and security aspects – and has an upgrade path to it’s big brother K2 blackpearl.   (This then adds Visual Studio support, and allows for hook outs to other LOB systems such as SAP, and via SmartObjects).

I’ve just installed the BETA on a local VM, and will blog more about some lessons learnt, and the features – especially keen to try out the new Silverlight designer !

Had to install .NET 3.5 – and Silverlight 2.0 (RTM) – and then the install proceeded successfully.

More info here :

image

Here’s a few screen shots (from the PDF) – just to get started :

K2 Studio – office-like workflow editor :

image

Process Portals – for managing process instances, security, etc :

image

K2 Web Designer – process designer using Silverlight – very cool :

image

Will update more with other screenshots / review / etc.

Updated K2 release

The new drop of K2 blackpearl has landed – entitled 0807.   The last release was 0803 – so not sure what the number means – unless I missed 0804, 0805 and 0806.  :-)

There’s a swag of improvements and some new features that I’m keen to check out.   I’d used an earlier Beta of 0807 – and keen to try out the RTM install set.

The 0807 release focused on greater stability and better performance than ever before.

It includes various enhancements and performance increases for the K2 Workspace, the K2 Designer for Microsoft Visual Studio 2005, and the K2 blackpearl Workflow Server to name but a few.

It also includes post-0803 patches and bug fixes.

New exciting features included in this release are Out of Office functionality and K2 Interop !

The K2 Interop is essentially the ability to open processes from the older K2.NET 2003 version.  Much like you would with a ASP.NET 1.1 (Visual Studio 2003) project – when opening in Visual Studio 2005, and upgrading to ASP.NET 2.0.

Of course, there’s a school of thought that says to simply “re-do processes” – to use new features, and re-visit/re-engineer the process – many businesses will have changed operation in the last 3-5 years – so a review, and re-design could be beneficial.

Also – there’s a new migration utility coming soon, which needs 0807.  This allows old processes from K2.NET 2003 to be “run” on the K2 blackpearl server – as opposed to opening and upgrading processes, just run with what was originally implemented.

And – without delving into EVERYTHING that the new 0807 setup will bring :

  • New Active Directory service – to retrieve & update to AD
  • Performance Enhancements
  • K2 Wizard Enhancements – stream-lined SharePoint integration
  • Documentation – many new topics, and Developer Reference

More info/blogs :

Some comments from Jey Srikantha :

(1) superior performance in VS.NET – much faster and efficient memory usage

(2) smartobject performance improvements

(3) workspace improvements & Out of Office functionality.

K2[blackpearl] 807 is here! Go get it!! 

Going to be great to try it out.  Click here to download : K2 [BLACKPEARL] 0807 (4.8210.1.0) 

NB.  Requires portal login – have to contact K2 for a login…

Custom code in K2 blackpearl

As you may, or may not be aware, the underlying code of workflows produced by K2 blackpearl have Windows Workflow Foundation (WF) at the core.

With the previous K2.NET 2003, there was a Notepad-like editor that allowed you to over-write the code generated for the event.  It was compiled “on the fly” – you could just update some code (to fix an error for example) – and then “continue” the workflow.

With K2 blackpearl, there are so many event wizards, templates and other functionality “out of the box”, you will may not ever need to write any custom code.   I haven’t had to as yet – but one day, I’m sure I will, for some reason or another.  

This is not the same as when using the K2 API and ASP.NET (C#) to open K2 connection, and worklist, etc – and inter-operating with the K2 server/runtime.   This is with regard to code within the workflow.

Another K2 Insider Gabriel Malherbe has posted a great article about how to add code to events within K2 blackpearl – with some screen-shots, etc. 

It’s not for the faint-hearted – code within WF introduces a new swag of functionality, acronyms and techniques – XOML for one – and I’ve never been a fan of the design interface for WF (within Visual Studio).

But – if you HAVE to include some custom code within a K2 workflow – and can’t achieve the same result by calling a web service, or SmartObject method – then this article is a good start.

Thanks Gabe !

Source : Writing custom code in a K2 blackpearl client event

Follow

Get every new post delivered to your Inbox.