I needed this ID because in my final activity I set a Sharepoint List Items event to delete the Task List Item created during the previous activity (SWIC, see Delete Task Activity in the figure above).
To accomplish to this necessity, I had to create a new process DataField which I called "TaskId"
Then I had to go inside the code generated by SWIC event and I modified the ExecuteForUser method body in the follow manner:
string taskIDstring = service.ModifyWorkflowAndGetTaskID(listId, listItemId, workflowInstanceId, modificationID, contextData, ""); // Put task item id into process data field "TaskID" string taskID = taskIDstring.Split(new string[] { "?ID=" }, StringSplitOptions.None)[1]; K2.ProcessInstance.DataFields["TaskID"].Value = taskID;
"service.ModifyWorkflowAndGetTaskID" calls a K2 web service who return a string contain the url of the task. A string like this: http://your MOSS server/Lists/Tasks/DispForm.aspx?ID=3.
Thank to this code I'm been able to delete Task List Item at the end of my process:
Save to delicious
0 saves
No comments:
Post a Comment