Solved

K2 Database query for workflow errors

  • 6 February 2020
  • 2 replies
  • 107 views

Badge +8

This may have already been answered.

 

Does anyone have a good general-purpose SQL query to provide a list out of the K2 database of workflow errors?  I'd like to set up a smart object/view to monitor ALL my workflows for ones that error out. 

 

This is what I've come up with so far:

 

select top 100 percent e.id, p1.FullName, date, e.descr, itemname
from k2.Server.ErrorLog e
inner join k2.ServerLog.procset p1 on p1.ProcVerID = e.ProcID

order by date desc

 

 

And it works up until the point a specified workflow gets modified, then the ProdID from the error table no longer matches the ProcVerID on the procset table. 

 

There's an "Object ID" column on the ErrorLog table, but I can't figure out what that joins to.  All I want to get as a result set is the name of the workflow and the date of the error the item name and the error description for the actual WORKFLOW, not hte current version of the workflow.

 

Thoughts?  

 

My guess is that this is pretty easy...I'm just not finding the right table to join to.

 

Rob

 

 

icon

Best answer by tbyrne777 6 February 2020, 19:43

View original

2 replies

Userlevel 5
Badge +13

On the Server.ErrorLog table, ther eis a ProcInstID which should be what you use to get at all the other information related to the error (join to ServerLog.ProcInst.ID then to Proc/ActInst/EventInst/ProcSet whatever)

Badge +8

Your answer helped.  Thank you.

 

This is ultimately what I came up with.  Excuse my crappy syntax.

 

select top 100 PERCENT Error.id, ProcSet.Name as ProcessName, Error.ItemName as ItemName, Error.Descr as Description, Error.Date as ErrorDate, procinst.originator as StartedBy
from k2.server.ErrorLog error
inner join k2.serverlog.ProcInst procinst on procinst.id = error.procinstid
inner join k2.serverlog.procset procset on procset.id = procinst.ProcSetID
order by error.date desc

Reply