I’ve got a sharepoint workflow with a state where I’m waiting to see what changes the user makes to the list item the workflow is attached to.
My state has a “OnWorkflowItemChanged” activity. On that activity I’ve bound the “AfterProperties” and “BeforeProperties” which created the following members in the code behind:
public Hashtable m_listItemBefore = new System.Collections.Hashtable();
public Hashtable m_listItemAfter = new System.Collections.Hashtable();
I then added a method for the Invoked event on the activity and thought I’d be fine. However, when the code reaches my Invoked function, the m_listItemAfter object contains all the new information, but the m_listItemBefore is empty.
Similarly, if I access the list item directly through:
this.workflowProperties.Item["field name"]
I’m also getting the new values.
The logic of my workflow requires that I see what they changed the data FROM as well as the new values. Any ideas on what am I doing wrong here?
I believe BeforeProperties are only available in synchronous events (ItemAdding, ItemUpdating) and not asynchronous events (ItemAdded, ItemUpdated).
This is quite a bummer and has bothered me a bit in the past, but I’m pretty sure that’s right. So, if you really have to have the BeforeProperties, you have to resort to a synchronous event.