Where did that activity data field go?

Every once in a while when I'm writing a server code event I have trouble remembering whether a particular activity data field is a destination instance field or an activity field and which API syntax is used to access it.  Things like that happen when you get older.  I use this little snippet in a server code event to help me out.  Attach to the process using the Visual Studio debugger and you'll see the messages in the output window.

            System.Diagnostics.Debug.WriteLine("K2.ActivityInstanceDestination.DataFields");
            foreach (DataField df in K2.ActivityInstanceDestination.DataFields)
            {
                System.Diagnostics.Debug.WriteLine("field: " + df.Name + " value: " + df.Value.ToString());
            }

            System.Diagnostics.Debug.WriteLine("K2.ActivityInstanceDestination.ActivityInstance.DataFields");
            foreach (DataField df in K2.ActivityInstanceDestination.ActivityInstance.DataFields)
            {
                System.Diagnostics.Debug.WriteLine("field: " + df.Name + " value: " + df.Value.ToString());
            }


Posted Wed, Aug 5 2009 1:47 PM by DavidL