This article will explore how to call a standard K2.net 2003 Collaboration Tools for Microsoft SharePoint Products & Technologies Workflow process from a custom workflow process, without using Microsoft SharePoint event handling, by means of an Inter Process Call (IPC).
K2.net 2003 Collaboration Tools has the following standard K2.net 2003 processes:
In this article we will use as an example a process that will by means of an Inter Process Call (IPC), call the K2.net 2003 collaboration process as defined within Microsoft SharePoint. This process is defined by means of an XML document within the Configure Workflow process. In order for this process to execute correctly, the original XML for the K2.net 2003 Collaboration Tools defined process must be contained within the custom process that will be calling the K2.net 2003 Collaboration Tools process. In other words, the IPC will have to emulate the "Submit to Workflow" event by passing the exact same data to the Configured Workflow process as what the event would have if the process was started from the event. In order for this to happen, the following information and code will be required:
EventDetail XML data
The EventDetail XML data structure that is contained in the Configured Workflow process must exist in the custom K2.net 2003 process that will be starting the K2.net 2003 Collaboration Tools process. This XML data field must be set prior to the IPC with the correct data, otherwise the IPC will fail.
The EventDetail XML contains the K2.net 2003 Collaboration Tools "process definition" as defined within Microsoft SharePoint. It is necessary to generate this XML within the custom process and to pass this information to the K2.net 2003 Collaboration Tools process. The following defines the EventDetail XML that must be contained within the custom K2.net process:
To set the above XML data structure, place the following code in a server event just before the IPC event that will start the K2.net 2003 Collaboration Tools process:
What is important to note in the above code is the following:
This code retrieves the workflow process definition as defined within SharePoint. The CurrentEvent variable refers to EventData/EventType node in the XML. In this case it is set to "Manual". This refers to a manual configured workflow process. For this document this will always be set to "Manual" as SharePoint events are not available.
Also important to note regarding the above code is that this relies on a string tale entry within the custom process. This string table is called "Configuration List" and the needed value is "WorkflowConfiguration". The above code statement will fail if this string table is not set up. The function uses the string table internally and therefore cannot function without the string table available.
The AttachedDocuments XML is important for the configured workflow to have a handle on the current document(s) that is associated with the process. This XML document is used to populate values within the EventDetail process XML as seen in the previously defined code sample.
After all the necessary XML process data fields have been set, an IPC can be made to the "SharePoint Workflow Services\Configured Workflow" process. The critical XML data that must be set is the EventDetail XML as explained earlier. See the attached process for an example of how this call is made with accompanied data and XML documents.