Skip to main content

Hi,


I want to achieve the delegate functionality from UI.


Can someone explain what each parameter of OpenWorklistItem mean. In fact there are 6 overloaded methods.


connection.OpenWorklistItem(workListItem.SerialNumber);
connection.OpenWorklistItem(workListItem.SerialNumber, "asp");
connection.OpenWorklistItem(workListItem.SerialNumber, "asp", false);


I've used the following code to delegate.


SourceCode.Workflow.Client.WorklistItem wli = connection.OpenWorklistItem(workListItem.SerialNumber, "asp", false);
SourceCode.Workflow.Client.Destination dest = new SourceCode.Workflow.Client.Destination();
dest.DestinationType = SourceCode.Workflow.Client.DestinationType.User;
dest.Name = "K2:DomainNameUsername";
dest.AllowedActions.Add("Approve");
dest.AllowedActions.Add("Reject");
wli.Delegate(dest);


I want the Delegate functionality to be able to Open the work list item to the DestinationUser i.e. the final delgated user to whom the task is delegated.


After delegation, is the worklistitem available to the delegated user, how to check this out? What should be exact status in the workspace?


I've tried several options, but when I try to action the task from the UI (here the UI is sharepoint), it throws an exception in the system generated code i.e.,


private void ExecuteForUser(string destination)
{
    service.ModifyWorkflow(listId, listItemId, workflowInstanceId, modificationID, contextData);  // this line passes.
                   
                    if (!K2.ActivityInstanceDestination.ActivityInstance.SingleInstance)
                    {
                        service.SetTaskPermissions(listId, listItemId, taskListId, workflowInstanceId, contextData, K2.ProcessInstance.XmlFieldsi"SPIntegrationData"].Value);  // this line fails.
                    }
}
Exception: “Unable to modify workflow: Server was unable to process request. ---> The specified user K2:DomainNameUserName could not be found. (Username is the delegated user)”. I'm completely struck here and unable to move forward. If I cross this line my custom code will get executed and everything goes fine I guess.
Is it looking for this user anywhere within the workflow in a specified format?


I've been trying this for some time now. I've posted seveal posts.
Can someone kindly explain this is detail.


Any pointers to this would be of great help.


Please comment whether this can be done or not? Its really urgent.



Thanks & regards,
Phanibabu Kandala

Hi Phanibabu,

When you delegate a user you must remember on how many slots your activity has been configured. In fact, if your activity has only one slot, when you open the task with the following code

connection.OpenWorklistItem(workListItem.SerialNumber, "asp", false);

you occupy the slot with the user who open the connection (for semplicity USER-A). So, when you delegate to the new user (USER-B), the activity s assigned in "allocated" status. You can find this information in K2 WorkSpace under management console-><your server>:5555->Workflow Server ->Worklists. To make possible to open the acivity with USER-B, there are two ways:

  • You release the activity after the Delegate (if I remember well, you could do this with sintax wli.Release();
  • You configure more than one slot for your activity.

I think you can found very useful this post http://www.k2underground.com/forums/thread/26487.aspx.

for the second part, you are using API call K2 sharepoint webservice. This is outside of my strength but just an advice: don't confuse K2 tasks with Sharepoint tasks created using sharepoint workflow integration process/client, they are two different entity. Use K2 worklist webpart to be compliance.

 HTH


Hi,


When I delegate a task using the code I've already posted, it delegates the task to the other user. i.e., User A delegated his task to User B, but the status in the K2 workspace for both the users is Available.


What exactly should be the status of the task when a delegation happens?


What exactly should be the status of the task when a redirection happens?


What will wli.Release() method do?


For the second part, we should not use K2 worklist. How can I manage the tasks in sharepoint.


Do I need to impersonate any user?


It would be really great if you could provide your comments in detail with a small example!!!!


Regards,


Phanibabu Kandala


 


Reply