ReleaseWorklistItem
I used k2mng 's ReleaseWorklistItem function.
oMng.ReleaseWorklistItem(oWli.ID);
In my app an activity is allocated to more than one users and there is single slot.
Say User A opens (locks) this activity, I want to be able to release it for use by all other destination users. I tried this method but nothing seems to be happening. Can you please help.
vingupta@deloitte.com
Worklist oWorkListCollection = oK2Connection.OpenWorklist(criteria);
if( oWorkListCollection != null )
{
if( oWorkListCollection.Count > 0 )
{
foreach(WorklistItem oWli in oWorkListCollection)
{
SourceCode.K2Mng.K2Manager oMng = new SourceCode.K2Mng.K2Manager();
oMng.Login(ApplicationConfig.ConfigData.K2ServerName, 5252,K2ConnectionFactory.GetK2LoginString());
if( approver == null)
{
oMng.ReleaseWorklistItem(oWli.ID);
}
else
{
oMng.RedirectWorklistItem(oWli.ID, approver.Approver_AD);
}
oMng.Logout();
}
}
}
Ex:
Worklist oWorkListCollection = oK2Connection.OpenWorklist(criteria);
if( oWorkListCollection != null )
{
if( oWorkListCollection.Count > 0 )
{
foreach(WorklistItem oWli in oWorkListCollection)
{
if( approver == null)
{
oWli.release();
}
else
{
oWli.redirect(approver.Approver_AD);
}
}
}
}
This is how I got it to work (only after installing the 0807 release):
SourceCode.Hosting.Client.BaseAPI.
SCConnectionStringBuilder connectionString = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();connectionString.Authenticate =
true;connectionString.Host =
"k2server";connectionString.Integrated =
true;connectionString.IsPrimaryLogin =
true;connectionString.Port = 5555;
WorkflowManagementServer
workflowServer = new WorkflowManagementServer();workflowServer.CreateConnection();
workflowServer.Connection.Open(connectionString.ToString());
foreach (WorklistItem worklistItem in workflowServer.GetWorklistItems("", "", "", "", "", "", ""))
{
if (worklistItem.Status.ToString() == "Open" || worklistItem.Status.ToString() == "Allocated")
{
workflowServer.ReleaseWorklistItem((int)worklistItem.ID); // Note the typecast to (int) creates potential for overflow error but you have to do it to get it to work.
}
}
workflowServer.Connection.Close();
Reply
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.