I have a requirement to read a value from a field in the current component in an external workflow activity using SDL Web 8.
I load the ComponentData using the following line of code:
ComponentData workflowItem = (ComponentData)CoreServiceClient.Read(ActivityInstance.WorkItems.Subject.IdRef, new ReadOptions()); //Note: I know the above will not work well if the item is in a bundle, and will fail if the workflow is a Page item
This works fine when creating a new component. When the item reaches this activity, the version is 0, and the revision is 1, and I get the current values of the component. So far so good.
The second time the item goes through workflow, the Component is retrieved, but it contains the old values, and not the field values which have been modified in the current workflow process.
How can I reliably access the current component that is in workflow.