This article refers to legacy products, components or features. Therefore, the content in this article is offered "as is" and will no longer be updated. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.
When a K2 SharePoint Workflow Integrated process has been set to start when an item is added, it may appear that the document metadata is not correctly populated in the process. This usually occurs when users start the process by adding a document and filling in the document metadata whilst doing the document upload. This article proposes a possible solution to this issue encountered by users.
SharePoint Workflow Behavior
K2 SharePoint Workflow Integrated process instances make use of a proxy component that leverages the SharePoint workflow infrastructure. These workflows exhibit the same behavior as Out of the Box SharePoint workflows. When a user performs a document upload followed by a document metadata update, the workflow instance has already been started and' in the case of K2 integrated workflows, the corresponding K2 process has also started. It is due to this reason that the document metadata appears to be empty when used in the K2 process.
This behavior is prevalent with K2 processes that are setup to start when a new item is added.
Below describes how to gain access to the document metadata after the workflow has started.
Proposed Process Design
The solution involves providing additional K2 process artefacts which include a SharePoint Get Document Metadata Event and an Activity Start Rule for the activity that contains the Document Get Metadata Event.
The Get Document Metadata Event should be contained in an Activity following the Start Activity and accompanied by a Start Rule that will delay the execution of the process.
Once the document gets uploaded the following takes place:
• The SharePoint workflow is invoked,
• The K2 process is started,
• A content XML field called “WFIProcessField” is populated with the SharePoint Item level data such as folder and item name.
This content XML field is then used to update the document metadata XML as chosen by the user on the metadata screen in the event.
A Start Rule on the Activity is required to delay the Event, giving the user enough time to supply metadata for the document being uploaded. The amount of time required is left up to the user to decide depending on the amount and complexity level of the metadata being added.