In Dynamics 365, field values can change all the time. Generally speaking, we only care what a field’s current value is, but there are certainly cases where we need to be able to track and audit previous values of a field. In today’s blog, we’ll describe a nifty trick for capturing not only what a field value changes to, but what it changes from, as well.
For purposes of our discussion, let’s assume we want to track the previous value of a field called “Account Name.” To accomplish this, you may intuitively think about adding a new field – something like, “Account Name Old,” perhaps. You’d be on the right track, but we actually need to go a step further and add a third field – something like, “Account Name Temp.” If we combine that with a workflow, we will have a working solution. Here’s how it works:
First, we create two new fields, Account Name Temp and Account Name Old (both single line of text). Whenever the value of Account Name changes within our workflow, we can start to copy information across.
- Step 1 – copy Account Name Temp to Account Name Old
- Step 2 – copy Account Name to Account Name Temp
It looks something like this:
Behind the scenes, it looks like this:
To test this process, I populated my 2 new fields into the account screen and played with the data. I created an account called “Happy Street School” and then changed it to “Sad Street School.” I saved after changing the name. As you can see below, the workflow achieved its goal: the Account Name Old field will ALWAYS contain the previous name.
Hopefully, this gives you a few ideas on how you can audit and track key fields by keeping the previous data visible on a field. If you would like more information on real-time workflows, check these recent blogs: