Write to K2 Process Instance Audit Log through API


Badge +1

Hi! Has anyone tried to add to the K2 Process Instance Audit Log using the API?  We are currently developing a custom solution where we redirect a worklist item, and we want to record this on the Process Instance Audit Log as well.

 

Any help would be appreciated.

 

Thank you!


5 replies

Badge +10

Not sure if there is an API that will let you write the audit log and I think it goes against K2's support aggreement if you write directly to the K2 database. One of the K2 mods can correct me if I am wrong.

Badge +8

Not to mention the whole point of an audit log is that it can't be modified from outside the owning process.

 

But to propose a possible solution to the OP: Redirecting a worklist item can be done via the SourceCode.Workflow.Management.WorkflowManagementServer.RedirectWorklistItem() method in the K2 API.  If you can wrap this call in your own method, you can create whatever auditing measures you deem appropriate when this method is called. 

 

However, it should also be noted that use of this method requires Admin rights on the server (not the process), so be sure to consider the security implications of this approach.

Badge +1

Thank you, s0m3one.  We would also not want to write directly to the DB.

Badge +1

Thanks, sbrownhuntoilco.  Yes, we currently are able to redirect as an Administrator using the K2 API.  We just don't know how to enforce the auditing via the API.  We want to record the user who did the redirect, as what the Audit Log stores is the Administrator's userID.

Badge +10

You could always write your own auditing smartobject and write into your own auditing tables and then use it in conjuction with K2 auditing. You would just use for example the process instance id to join the K2 auditing to your own auditing tables. You could record into your own auditing tables when a request is started and in every activity when it is action or assigned. Its just a case of dropping a smartobject event in the workflow to call your auditing smartobject.

 

Reply