This has been a blog post that has been in the making for quite some time. I just haven't had the time to do everything I wanted with it and actually sit down and write about it. Even now, I'm swamped, so the text in this post will be limited. I do have a video that you'll find below, that goes through what this does, how it does it, and why you'd want it.
The aim here, was to build some logic that would let me know, in a Nintex Workflow, what fields have changed and what their before and after values are.
You do have other options that what I'm talking about. You could keep another list fields that stores the before values and then when your workflow runs, it could compare to the current values.
The way I've done this, is via two User Defined Actions (UDAs).
1. Initial Change Token UDA (this is used in a workflow that would run when an item is created.
2. Get Modified Fields UDA (this is used in a workflow that is set up to run when an item is modified).
REQUIREMENT : You need to create a field in your (hidden preferably). This will store a bunch of XML throughout this process.
Also, the UDAs make webs service calls, where I'm using a Nintex Workflow constant. You'll need to tweak those to use your constant.
Basically, the UDAs here work, because they use the awesome web service, Lists.asmx. Thank you Microsoft. It exposes a lot of functionality that we can use here.
The three web methods that you have a choice of, are GetListItemChange, GetListItemChangeSinceToken and GetListItemChangeWithKnowledge.
I use the GetListItemChangesSinceToken, and am using the Query XML action to pull the information I need out of the XLM data. I also store the XML in the ChangeXML field I have in my list. Ideally, I'd just store the token, but I had plans in the future of doing some other things with the data, so I kept the entire XML.
Design - Initial Change Token UDA
I couldn't fit the entire design screenshots into this post. But you're free to download the UDAs and the workflows at the bottom of this post.
Design - Get Modified Fields UDA
I may add some more here later, but for now, all the information is in the video and also in the files you can download below.