Skip to main content
Hi

As a part of Order distribution, we are storing the User to whom the Workflow is to be assigned in a process level data field.

My problem is, Update of the processInstance is taking a lot of time.This in turn, sometime times out or does not assign the user to the Workflow 😞

Code
SourceCode.K2ROM.ProcessInstance p = c.OpenProcessInstance((int)parms[0]);
foreach(string key in t.Keys)
{
p.DataFields[key].Value = t[key];
}
p.Update();

Am looking for any resolution
Hi,

If you are using Windows Authentication why don t you use Originator?

A few questions:
1. Is there a specific reason why you are using a loop to update every field? You only have to update the process instance.
2. What GUI kicks off the process?

I just want a clearer explanation on what you want to achieve.

Have a look at the "CreateProcessInstance" code:
.Value = System.DateTime.Now.Hour.ToString() + ":" + System.DateTime.Now.Minute.ToString(); 

//Set the Process Folio
oNewProcessInstance.Folio = "My Process Folio";

//PlanStart new Process Instance
oK2Connection.StartProcessInstance(oNewProcessInstance, false);

//Close the Connection
oK2Connection.Close();

}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}



Use the following code to update etc.

.Value = System.DateTime.Now.Hour.ToString() + ":" + System.DateTime.Now.Minute.ToString(); 

oWorkListItem.Update();
//OR
oWorkListItem.Finish();
}
}
else if(oWorkListItem.ProcessInstance.Folio == strFolio)
{
oWorkListItem.GotoActivity("Declined", false); //Force the process to another Activity contained in the same Process
//OR
oWorkListItem.Redirect(strNewDestination); //Redirect the WOrkitem to a different user
//OR
oWorkListItem.Sleep(true, 24); //Removes the workitem from the users worklist for the duration specified in seconds
}
}
}
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}

I found them in the K2.net 2003 help file.

Hope this helps.

Reply