Skip to main content

I was wondering if anyone knows of a way to check all active workflows and find which are on a specific workflow activity.

e.g. I have a workflow with three activities 1,2,3 and I want to find all active workflows that are currently waiting on activity 2

 

Is that possible? I suspect there'd be some sort of record in the K2 database but I'm not sure if theres anything I could query

Hi - it depends on what you mean by "Stage"... is it a particular task? Activity? Sub-process? Other?


Sorry I think activity is the correct word to use


Ok, there are a couple of different ways to do this... thee is the "Activity Statistics" report and the "WorkLists" section under the Management Console (K2 Workspace). I tend to use the WorkLists section as it is faster than the report, does that help?


So using the worklists section helps a bit since I can filter by activity name. Though if I wanted to check only 5 specific process instances would that be possible?

 

so like select * from sometable where actvity name like 'activity 2' and process instance id in (1,2,3,4,5)

 

if the worklist page can pull up the information then surely I should be able to find it within the k2 database no?

 


Oh, sure, if you want to query the K2 database you could do something like this (you'll have to tweak it a bit but this can get you started):

SELECT pset.name, a.name

FROM serverlog.procinst pi

JOIN server.[proc] p ON p.id = pi.procid

JOIN server.[procset] pset ON pset.id = p.procsetid

JOIN serverlog.actinst ai ON ai.procinstid = pi.id

JOIN server.act a ON a.id = ai.actid

 


took a while to understand what each table is for but I made sense of it in the end and I kind of query I wanted. Thanks a lot!

 

did something like this

 

SELECT pi.Folio, pi.ID, ai.status

FROM k2.server.procinst pi

JOIN k2.server.rproc] p ON p.id = pi.procid

JOIN k2.server.rprocset] pset ON pset.id = p.procsetid

JOIN k2.serverlog.actinst ai ON ai.procinstid = pi.id

JOIN k2.server.act a ON a.id = ai.actid
where pset.ID = 1 and p.id = 7 and ai.ActID = (whichever activity I want to search for) and pi.id in (put process instance ids here)

 

I also changed the k2.serverlog.procinst to k2.server.procinst, does it make a difference though?

 


The tables in the serverlog schema contain all items whether they are active or not. The server schema tables are only active items. I tend to use the serverlog tables to be comprehensive.


Reply