Skip to main content

I am trying to create a page that shows each task assigned to a user. So if UserA logs in, they only see tasks assigned to them (in a list or a table or a grid). Right now we use roles in our destination rules to assign tasks.


I've sifted through the API and Smartobjects but am not quite sure if the users listed on some of those are the folks originating the workflow or the destination user. An example would be 'List User Workload Detail'. Is the username returned the assigned person or the person originating the workflow?


Does anybody have a method to do this?

Based on given description, if user logins into the page, then he should be able to see tasks that are assigned to him. Hope this page will be available  for all users


In this case it does not matter of his role ( originator or approver/destination user). Below code help you to retrieve list of tasks that are assigned to him.


 


SourceCode.Workflow.Client.Connection oServer = new SourceCode.Workflow.Client.Connection();


 SourceCode.Workflow.Client.WorklistCriteria oCrit = new SourceCode.Workflow.Client.WorklistCriteria();


 SourceCode.Workflow.Client.Worklist oWorklist;


oServer.Open(ConfigurationManager.AppSettingsi"K2ServerName"]);


 


oCrit.NoData = true;


 oServer.ImpersonateUser("K2:" + “Domain/UserID”);


 oWorklist = oServer.OpenWorklist(oCrit);


 


 if (oWorklist.Count > 0)


{


                //You can iterate list of tasks


}


Reply