30 day trial
Today’s guest blogger is CRM MVP Leon Tribe, a Microsoft Dynamics CRM Consultant based in Sydney, Australia.
The workflows in Microsoft Dynamics CRM 4.0 are very powerful. Here is an example of an auditing tool which can be implemented without code, without additional attributes or additional entities and if you just need an audit log to roll back when people make mistakes, it should do the job.
Step 1: Setting up the Workflow
The workflow is pretty simple. All you do is create a note when a new record is created or when a specific field is changed.
In this case I’m auditing the first name attribute of the Contact record. The details of the note are thus:
That’s 90% of the work now done. We publish and the engine is in place.
Step 2: Make some changes
When we create a new contact or change the ‘First Name’ field, a new note will be created against the contact showing the current value. To determine the previous value we look back through the notes.
If there are extensive notes, we can use Advanced Find
We can even save the Advanced Find as a View and while there is no simple way to access the log through the interface, we can always go to Advanced Find – Saved Views.
Each time you need to audit a new field you just create a new workflow. If you are monitoring many fields, a plug-in may be a better option but if you need an audit tool to manage a few key fields and don’t want to spend a lot of time messing about, this should do the trick.
Hi Leon, How would you record what the field value was originally?
If you want to monitor a fixed set of fields, you can also add them to the same note, giving you the information as:
Anton Kirilov modifed at 6/30/2010 8:01pm the contact from:
If someone changed a number of fields, it will not lead to that much notes.
Good article, keep it up!
Great to see the power of Workflow in CRM. And even better: the Business Data Auditing Accelerator provides a similar, yet more complete auditing option.
To download: crmaccelerators.codeplex.com/.../27404
A blogpost showing it: blogs.msdn.com/.../business-data-auditing-accelerator-for-microsoft-dynamics-crm-online.aspx
Hi Leon,nice idea
To really fulfill auditing needs also the old value of the field needs to be stored. I could not find a way to do this
Another option that takes a little more work, but gives you a much better UI for looking at the audit trail is to use a workflow, but instead of creating a note, create a new entity, and copy all of the fields from the current entity whenever any field changes.
Because the workflow fires on the record creation, the previous note created for that attribute holds the previous value (the first note being the original value). If you want a note line that records both, you need a plugin.
An alternative, although a more labour intensive solution to the 'previous value' issue, is to create an attribute to hold the previous value. On record creation, the value of the field is copied to this new attribute. On change you would do something like:
1) Write a note showing both the field and the new atrribute values
2) Copy the value of the field to the new attribute.
Great idea! Just wanted to add that there's a quick way to add this to the standard UI: copy the shortcut to the view, export the SiteMap.xml, and paste the link within a new SubArea element.