Skip to main content

Hi,


I have a requirement where I need to display the active workflow tasks from all the workflows (similar to Workspace Worklist Page). I used Workflow Management Server APIs and built this and I have added lot of custimizations as per business requirement and it works so fine. But we have many K2 BlackPealr workflows and so have thousands of active tasks in the system. suing APIs I have used paging to show only 20 items per page with custom pagination but still querying through APIs taking too much time.


So finally came up with a query where I can bring the complete information for WorkList columns, but except WorkListItem ID. Intially I thought K2server]..dbo].._Worklist] table will have a column called 'ID', but it doesn't  have anything like that. So that is stopping me to go froward. When I debug the API code and capture Workflist Item ID and I found some number which didn't give me any clue to understand that it is formed with any combination of other IDs like ProcessInstanceID and ActiveDestination ID.


So If any one came accross this and have any solution to find out workflist Item ID from table. Please help me.


Here is the Query I am using to make a custom worklist from a query (Need worklist Item ID in the select columns list).


SELECT  PIn.ID ProcInstID,PS.Name AS ProcessName, PIn.Folio, AC.Name ActivityName,WL.Destination,WL.Status, PIn.Status WfStatus


FROM /K2ServerLog]..<_Worklist] WL INNER JOIN /K2ServerLog]..<_ActInstDest] AD ON WL.ActInstDestID = AD.ID INNER JOIN ..dbo].._ActInst] AI ON  AD.ActInstID = AI.ID INNER JOIN NK2ServerLog].>dbo].>_Act] AC ON AI.ActID = AC.ID INNER JOIN IK2Server].dbo."_ProcInst] PIn ON PIn.ID = WL.ProcInstID INNER JOIN IK2ServerLog]."dbo]."_Proc] PR ON PR.ID = PIn.ProcID INNER JOIN OK2ServerLog].dbo._ProcSet PS ON PS.ID = PR.ProcSetID


WHERE AI.ProcInstID = PIn.ID AND AD.ProcInstID = PIn.ID AND


WL.Status in (0,1,2)



P.S: I know that we are not supposed to create/alter any objects on K2 Databases, so creating this query/view on my custom database with in the Same SQL Server Instance.


Thanks in advance!


 


Thanks
Srinivas Vangala


 


May I ask what you need the worklist item ID for?  Typically, anything you need to do to a task can be done via serial number which is process_instance_id _ activity_destination_instance_id.  I know I'm not answering your question, and I'll help if I can but I'd like to determine that the question needs to be answered.


Hi,


I want to redirect the selected task from my custom worklist page. I have provided piece of code below to redirect the task:


 



workflowServer.RedirectWorklistItem(oldDestination, newDestination,



int.Parse(procInstID), int.Parse(actInstDestID), int.Parse(workflowItemID));


If you look at the above redirect function it always asks for WorkfloItemID.


After creating this ticket I was looking at a table called "WorklistSolt", it looks like the ID of this table is a WorklistItemID that is coming for each task in worklistwebpart. Still I need to verify this.


Thanks!


 


 


Ok, well, you can also use the Workflow Client Connection to open a worklist item by serial number, and then use the 'Redirect' method off of that (which is what we do).  Either way should work, it just does seem like worklist item Id is more difficult to isolate than serial number.


Honestly, I have expected this answer from you. YES, you are right we can use client APIs to redrect as we can make out serial number using ProcInstID and ActDestID, but we need to make the user who is redirecting the task (other's ) as an admin and he needs to impersonate the actual user who has the task. Please correct me if I am wrong here. I think even for server APIs also we need the user as an admin for the workflow to redirect. Still thiking on these options :)


But if you find anything wrong with my statements please correct me and thanks for all you replies, you really reminded me of the options we have to fullfill my requirement.


You are right - it is a little more convoluted my way because you need to find the worklist item via management API (to see who it is assigned to) then impersonate that user to open it and redirect it via client API.


Hi,


Looks like I ahve found a SP which is used by worklist frame from workspace. I think this may help me to understand how we can retrieve the tasks.

Here is the Stored Procedure found under K2Server DB.



[mWorkListItemsGetFilter]


When I ran this, it is taking more time to get the results. I think this is the culprit for taking more time when we call the APIs to get the results. If I find anything more will post you.


Thanks


 



Hi,


Forgot to mention somehitng about the SP I found  " >mWorkListItemsGetFilter]".


Anyone who follows this post, please don't change anything to this SP or anything directly on K2Default databases. I mentioned this SP here only to know how the task list works as I need to understand the functionlity for one of my requirements. K2 Doesn't doesn't support any changes to their databases directly. So please be aware of this.


Thanks.


Reply