K2 BlackPearl Management Worklist Webpart Customization - Netwoven

K2 BlackPearl Management Worklist Webpart Customization

By Niraj Tenany  •  July 17, 2012  •  2163 Views

Netwoven Blog

In this blog post we will discuss K2 BlackPearl Mangement worklist webpart customization.

K2 offers Management Work list webpart and Work list webpart for managing work lists. However, there are situations when the webparts need to be customized to meet additional business requirements. Recall that the out of box K2 Management Worklist web part requires the user to have admin rights on the process and presents all process instances of that process running in the system without providing any filtering functionality?

Disassembling the appropriate K2 assemblies and inspecting the source code of ManagementWorklistWebPart class, we can see that the bulk of the processing to fetch the data to be displayed happens in the LoadWPData() method and a fair bit of the processing is performed using classes declared internal to the assembly. The end result of the processing is the creation of a DataTable object containing data for all process instances and assigned to a class member. There are two different options to enhance this class:

  • Option 1 – Override this method in a class derived from the out-of-box ManagementWorklistWebPart class.
  • Option 2 – Invoke the base class’s LoadWPData() method in the derived class followed by applying the desired filter on the created DataSet.

Below is an implementation of Option 2. To prune down the unfiltered data set, it’s joined with a data set containing only rows of interest. This 2nd data set can be created in any desirable way (e.g. using filter parameters exposed as web part properties). In our implementation it’s created using a process SmartObject’s GetList() method, which is then filtered based on the Project ID stored as Process Data Field in the current process instance. The joined data set is stored in the class member _dataTable, from where it’s rendered using other methods in the base class.

public override void LoadWPData()

{

try

{

// Create the unfiltered data set using base K2 class

base.LoadWPData();

// Create the filtered data set using DHF SmartObject and join with Unfiltered set to remove unwanted rows

DHFProcessData dhf = new DHFProcessData();

dhf.Status = 1;

if (bFilteringInEffect)

{

DataTable dt = dhf.GetList();

IEnumerable<DataRow> query =

from processInst1 in _dataTable.AsEnumerable()

join processInst2 in dt.AsEnumerable()

on processInst1.Field<string>("ProcInstId") equals processInst2.Field<string>("ProcessInstanceId")

select processInst1;

DataTable boundTable = query.CopyToDataTable();

this._dataTable = boundTable;

}

}

catch (Exception ex)

{

this._errorList.Add(ex.Message);

}

}
Niraj Tenany

Niraj Tenany

Niraj is Chief Executive Officer and a Co-founder of Netwoven, responsible for the strategic vision and direction. Niraj has been working with Fortune 500 companies to implement large-scale enterprise systems for the past 25 years. Prior to founding Netwoven, Niraj led a profitable Enterprise Applications Consulting Practice at Microsoft. His team implemented large scale deployments of enterprise applications like Siebel, Ariba, and SAP with Fortune 500 customers. Niraj’s team also led the design and implementation of OLAP solutions based on the Microsoft platform. Prior to joining Microsoft, Niraj led a profitable Business Intelligence Consulting practice with Oracle Consulting Services. Niraj has also worked with startup organizations in senior management positions. Niraj was the Director of Consulting Services at Zaplet, a Kleiner Perkins funded company. Niraj holds a BS in Computer Science from Birla Institute of Technology, India, an MS in Computer Science from State University of New York (SUNY), and an MBA from Duke University’s Fuqua School of Business in North Carolina.

Leave a comment

Your email address will not be published. Required fields are marked *

Dublin Chamber of Commerce
Microsoft Partner
Microsoft Partner
Microsoft Partner
Microsoft Partner
Microsoft Partner
Microsoft Partner
Microsoft Fast Track
Microsoft Partner
Microsoft Fabric
MISA
MISA
Unravel The Complex
Stay Connected

Subscribe and receive the latest insights

Netwoven Inc. - Microsoft Solutions Partner

Get involved by tagging Netwoven experiences using our official hashtag #UnravelTheComplex