What can I do with the K2 BlackPearl SharePoint Event Templates "Content Field"?

  •  07-14-2008, 7:16 PM

    What can I do with the K2 BlackPearl SharePoint Event Templates "Content Field"?

    When building a SharePoint Event to update or create an item in a SharePoint List, you might ask, "What can I do with this Content Field?"  Basically, this field allows you update or modify the metadata for items in a SharePoint List, Document Library, etc or to simply keep a reference (in your process) to items or documents in a Process XML field for updating later in the workflow.  In this post, I will answer the question above.  I will assume you are familiar with K2 Workflow Design.


    As an exercise, create a simple test K2 process (I will assume you are an administrator of the K2 Host Server):

    1)    Drag over the Default Activity template to the design canvas and drag a line from the Start activity to this one.
    2)    Add a SharePoint List Event template to this Activity. 
    3)    Move through the wizard as follows:

    a.    Start by making this one a Create List Item type. 
    b.    Fill out the required information (SharePoint Site URL) and pick the Task list in your SharePoint site (another list is fine if you wish).
    c.    Do not enter anything in the List ID field
    d.    Check the “Add item to this content field” and click the Create button to create a process XML data field (the content field).

    4)    For the metadata mappings, you could hard code some values if you wish or create some process datafields with some default values.
    5)    Add a Default Client event below the ListEventItem, in the wizard: give it a URL for a bogus client page, accept the default actions and outcomes (you will not need the line rule generated), and move through the wizard to make yourself the destination user.
    6)    Navigate back to K2 Workspace Management console and give your user account permissions to start the process (at the very minimum)
    7)    Start an instance of the process
    8)    Navigate back to K2 Workspace to view your worklist
    9)    Find the worklist item for this test process and use the context menu to view the Data Field values in the process instance.
    10)    Click on your Process XML field name to view the Content Field XML data.
    11)    You should see something like this:
      <Items Type="ListItems">
      <Item ID="1">
      <SiteURL>http://moss.k2demo.local</SiteURL>
      <ListURL>Tasks</ListURL>
      <FolderURL />
      <Item>1</Item>
      <URL>http://moss.k2demo.local/Lists/Tasks/DispForm.aspx?ID=1</URL>
      </Item>
      </Items>

    The structure above acts as a pointer or reference to the SharePoint List Item inside the K2 process instance. Remember, the XML above does not contain any content or metadata values.

     If you were to test this further, you would find that for any Document or List Item created in SharePoint using the create type of SharePoint event templates, you can store multiple items inside a single Process XML field and take action upon those items later in the process, such as updating their metadata when a user has finished a worklist item.  You could also write custom code in the process to modify the XML of the content field.


    - Sam


    --------------------------------------------------------------------------------
    The statements and opinions made in my postings are my own, and do not reflect the opinions of SourceCode Technology Holdings, Inc. or its subsidiaries. All information is provided as is with no warranties, express or implied, and grants no rights or licenses.
View Complete Thread