Skip to main content

Hi all


I've got a bit of a weird issue here and could use some help.  We have a workflow that was working on a pilot server. As the pilot was successful, I've move the project onto a proper dev server and redeployed it.  Everything seems okay yet something is going wrong...


New process instances are raised in code and this works fine - note the datafield being assigned...


Connection

K2Con = new Connection();
K2Con.Open(ConfigurationManager.AppSettingsg"K2Server"].ToString());
ProcessInstance pi = K2Con.CreateProcessInstance(@"<my process name>");
pi.DataFieldsd"List ID"].Value = li.ID; //this being a list id from sharepoint
K2Con.StartProcessInstance(pi);
K2Con.Close();


so far so good.  Now if I look at this item from the k2 workspace i can see the datafield and it's value.  However, if i try and iterate through my worklist and access this datafield, it says it can't be found...


Connection

K2Con = new Connection();
K2Con.Open(ConfigurationManager.AppSettingst"K2Server"].ToString());
Worklist wk = K2Con.OpenWorklist("ASP");
foreach (WorklistItem wki in wk)
{
     if (wki.EventInstance.Name == "<my event name>")
     {
          Int32 listID = Convert.ToInt32(wki.ProcessInstance.DataFieldsc"List ID"].Value.ToString()); This is what errors with 'Datafield List ID not found'
     }
}


I've done a sanity check and the serial numbers of the process instance i'm viewing though the workspace and the one i'm getting in code are the same so it is the same item.  it's a brand new dev server so has no other proceses running on it - this is the only active instance.


Any ideas?  Could it be a permissions thing?  Or something to do with moving the code to a new server?  Any help anyone can give would be great.


Thanks!
P

Not to worry - found the solution/problem.


In case anyone else has a similar issue - The version of K2 on the new server is later than on the pilot server and following a known bug (discussed further in this forum post http://k2underground.com/forums/thread/23914.aspx) I just needed to add wki.Open(); inside my foreach loop and it works again.


Cheers
P


This is a bug in 0803 and a hotfix is available for it.  See http://kb.k2workflow.com/articles/kb000257.aspx


 


Thanks Johnny, I'll get our infrastructure guy on it.


 


Reply