Deletion of tasks from different users

  • 15 October 2008
  • 2 replies
  • 3 views

Badge +4

Hi all,


 


I have a scenario where a user can go and close an initiative.


Now there can be N number of worklists sent to X number of users for that initiative.


I need to delete all the worklists sent to all the users for the initiative and stop the workflow.


I am not able to work out first of all how to get all the worklists for the initiative and then how to delete them.


Has anyone worked on similar kind of scenario previously?


Any pointers will be helpful.


 


Regards,


Ritesh


2 replies

Badge +3

I started IPC processes for an unknown number of elements (Plan per destination - no slots).  I assigned the parent ID to the folio with the name of the IPC.


 Basically, I have Withdraw Item ID: ##, and Review Item ID: ##.


If a user withdraws an item, I iterate over the worklist, checking the folio.  If I find a match, I use gotoActivity to cancel any pending events in that workflow and move to a new activity that sends an email to the previous recipients.  you have to do the opposite if the user approves the item, removing any pending withdraw events.


WorkflowManagementServer wms = new WorkflowManagementServer();


 


wms.Open(K2.StringTable[

"Workflow Management Server"]);


ProcessInstances instances = wms.GetProcessInstances();


int itemD = Convert.ToInt32(K2.ProcessInstance.DataFields["itemID"].Value);


 


foreach (SourceCode.Workflow.Management.ProcessInstance instance in instances)


{


if (instance.Folio.Contains(String.Format("Review Item ID: {0}", itemID)))


{


wms.GotoActivity(instance.ID,

"Withdraw");


}


}


 

Badge +4

I tried the piece of code and it finished the workflow.


I am facing another problem.


I am doing Sharepoint Integration in my process.


Now when i finish the process from a sharepoint activity to another activity which finishes the workflow, the sharepoint task remain in the sharepoint task list.


Can somebody help me on how to complete/cancel the sharepoint task?

Reply