How to provide a list of all Active and Complete workflows and filter by a DataField?

  • 30 August 2011
  • 2 replies
  • 2 views

Badge +3

Hello, the business requirment that I recieved has me stuck.


User needs the ability to search across ANY worklist regardless of who actually has ownership of worklist item, and it should not matter what “Step” in the workflow, and it should not matter what “status” of the Workitem (Open, Available, Sleep, Complete), and it should not matter what “status” of the Process (Active, Complete).  User will want to specify a Filter to pull back items for the 1 workflow process and they will provide 1 or more data fields (for the filter).



The part about pulling process information for "Complete" workflows has me a bit stumped.  Could you try to point me in the right direction?  What options do I have?



Many Thanks, Jason.


2 replies

Badge +10

Hi,


Searching across all worklist items should be done using the SourceCode.Workflow.Managment API. This will get you all the Open, Available or sleeping worklist items regardless of owner. Look at the following section in the documentation to see how this is done: Developer Reference > Processes > Accessing > How to access and return information from the Global Worklist. This is the preferred way to access these items if you need to do something with these instances. It is not commonly used for reporting.


The completed instances are only available through the reports. Reports pull from the K2 Reporting SmartObjects and you can query the Event_Instance SmartObject to see a list of ALL Events. This report will however show all events, whether they are Server Events or Client Events. It is up to you to discover what type the event is. This report will also report on all instances whether still active or completed.


The SmartObject is most probably the way you should go. You can filter on any of the columns, but as I mentioned it will be up to you to determine which events are actually client events. Even this is not too difficult. Create a table where you specify which Events are client events and use this in the SmartObject execution using ADO.NET in the "WHERE EventName in" clause:


SELECT * FROM Event_Instance
WHERE EventName IN ('Approval', '2nd Approval Task')


Hope this helps!

Badge +3

Thank you very much.

Reply