This is a quick post to share a tip that I found to create a field to track changes to another field. Sure you can do it with a trigger and some code, but this is a no-code work-around.
I found this idea on Salesforce Idea Exchange here and modified it as I needed to. The reason to use this idea is that the History Tracking feature only tells you that the field has changed, rather than the field value has changed from x to y.
If there are just a few key fields that you need to do full audit tracking on, then this may be an option. I have set this up on Cases for the custom Case Response field – the field that contains the information as to what was done to resolve this Case.
- In Cases, Add a new long text formula field called Case Response History.
- Create a new Workflow Rule called Append Case Response History or similar to do a Field Update on the Case Response History field
- The formula for the Worflow is something along the lines of this:
"Last Modified: " + LastModifiedBy.FirstName & ' ' & LastModifiedBy.LastName + TEXT(LastModifiedDate + 0.4167) + BR() + "------" + BR() +
PRIORVALUE( CaseResponse__c ) + BR() +
- You can play around with this formula, but I found this layout was good. The main components are that we are updating the Case Response History field with the previous value of the Case Response field, along with all the previous history that is already in the Case Response History field, then tagging it with the name and date of the update. I also have a line to divide each entry.
- The 0.4167 in the date formula converts UTC time to Sydney timezone. The default date format is a bit ugly, so you may want to do a lot more tweaking of this date field to change the format.
- The current value is in the Case Response field – this field only shows us what the previous value(s) were. The way I have set this up is that it shows the date that the current value was updated with the date/time and who updated it, in the history field. That way the next time the field is updated, that value will be listed with the date/time record of when it was updated. You need to test this out with a few updates to the field to see what I mean here (it makes sense to me, at least). If you don’t like this, then just modify the formula.
- Add the Case Response History field to the Cases Page Layout so you can see the audit history on the Case Record.
- Beware: This is not entirely foolproof. The System Administrator or anyone with Modify All Data can edit the Audit field.
- This would probably be better as a hidden field that doesn’t take up space on the Cases form.