Skip to main content

Hello,


 I'm trying to build a list of all processes currently running that have a particular datafield set to a specific value across the organization (not just for one user).  I found from documentation regarding 2003, that the K2manager will accomplish this.  I made a reference to that dll and found getprocessinstancesall() method, but it doesn't accept criteria as a field.  Any ideas on how to accomplish this?  We're a financial institution and what I am trying to do is show all of the open cases for a particular customer.  I'm using the datafield to set an account value and trying to reference that within the processlisting aspx that I'm building.  If I can't do that natively in K2, I can always make a lookup table and have K2 write to that table each time a process is initialized for a member and flag the respective record when the process has completed.  It's possible, but I'm sure there's a cleaner way to do this in K2.


 


Thanks,


Jason
 

jason -- i'd recommend you go thr lookup table route.  that way you can also index the fields you're searching on to retrieve  a list of process instance IDs to get your list of processes faster.  you may just as well pull some of your K2 specific report data at the same time so you don't have to go back to the K2 dbs unless absolutely necessary.


when searching for data in K2 datafields ... you can see this if you poke around the data model a little ... the datafields are packed into a single field (of type ntext i think) so filtering on process data is operationally inefficient ... unless i'm totally mistaken, i think the K2 api needs to load all the process instance data from the db into memory to do criteria searches, then forgets about all the data that doesn't match the criteria.  but it's effectively doing a full table scan for all data field searches since the data is packed (denormalized) and unindexed.  there are some other operations which are far more efficient.  these are api operations that look at indexed fields like process ID, etc


sounds like you're on the right track. 


hope that helps.


Sherif,

 Thanks for the feedback.  I feared that this may be the only solution, but it gives me great control to do other kinds of lookups too.  On your sentence "you may just as well pull some of you K2 specific report data at the same time...", what did you mean?  Are you referring to storing additional details in the lookup table to assist in reports like benchmarking and how many type 1 widgets did customers request in a month and so on?  Or, are you referring to the type of reporting that K2 offers out of the box being stored within that table? 

 

Thanks,
Jason
 


Jason,


The Management API (K2MNG.dll in K2 2003 and SourceCode.Workflow.Management in blackpearl) do not have any context around datafields. 


With blackpearl, the typical design pattern to accomodate this type of scenario is to create a SmartObject to store all your business data (like customer).  Then within the process, you create a process datafield called CustomerID that stores the SmartObject ID to the customer record.


With a SmartObject setup, you can then create an association between the SmartObject and the Process relating the Process Data Field "CustomerID" to the SmartObject property CustomerID. 


You can then create a report that joins these two together and filters based upon something like customer name and workflow status.


HTH.


Reply