List completed processes using K2 API


Badge +1
Hello,
How can I get a list of Completed workflow processes using the K2 API.

Regards,

2 replies

Badge +8
Hi,

completed process instances can not be accessed with the K2ROM.

Other options include writing a web service which queries the K2ROM database or writing the values you are interested in to a sharepoint list or external table for viewing just before the process ends.
Badge
Below is a simple MS SQL stored proc that will return all the completed worklist items for a particular individual within the K2 Log database:

Select procRights.ProcSetID,
procRights.[User],
process.,
IsNull(Convert(varchar(10), procInst.StartDate, 101),'') as StartDate,
IsNull(Convert(varchar(10), procInst.FinishDate, 101),'') as FinishDate,
procInstData.Value as RecordID

From _ProcRights procRights
join _Proc process
on process.ProcSetID = procRights.ProcSetID
join _ProcInst procInst
on procInst.ProcID = process.
join _ProcInstData procInstData
on procInstData.ProcInstID = procInst.

Where procRights.[User] = @UserName
And procInst.Status = 3
And procInstData.[Name] = 'RecordID'

The 'RecordID' is a specific Data Field within my workflow process. You will need to tweak the stored proc for your particular needs but this should get user started.

Steve.

Reply