SharePoint Workflow: How Do I Get the "PreProperties" in the WorkflowItemChanged Event Handler
I have a stateful sharepoint workflow that I am waiting to see what changes the user makes to the list item the workflow is bound to.
There is an OnWorkflowItemChanged activity in my state. In this activity, I linked "AfterProperties" and "BeforeProperties" which created the following items in code:
public Hashtable m_listItemBefore = new System.Collections.Hashtable();
public Hashtable m_listItemAfter = new System.Collections.Hashtable();
Then I added a method for the Invoked event for the activity and thought everything would 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.
Likewise, if I access a list item directly via:
this.workflowProperties.Item["field name"]
I am also getting new values.
My workflow logic requires me to see that they have changed the FROM data as well as the new values. Any ideas on what I am doing wrong here?
a source to share
I believe BeforeProperties are only available on synchronous events (ItemAdding, ItemUpdating) and not asynchronous events (ItemAdded, ItemUpdated).
This is quite a bummer and has worried me a little in the past, but I'm sure it does. So, if you really need to have PreProperties, you need to resort to a synchronous event.
a source to share