Skip to content
Microsoft Dynamics 365 Blog

Today we welcome back guest blogger Guy Riddle, a long time CRM MVP who shares his insight with us.

Out of the box, Microsoft CRM provides some basic record audit information – who & when created a record and who & when it was last updated by.

Occasionally I get asked for more detailed audit capabilities (typically from clients in the Financial Services industry). I also find that Sales Managers are interested in tracking changes made to the Opportunities – in particular the requirement is around key information that changes that has a direct impact on the Sales Pipeline E.g. Estimated Revenue; Estimated Close Date; Sales Stage/Probability; Rating; etc.

In a CRM 3.0 deployment we would typically have addressed this with writing a custom Callout. However, utilizing two of the new (and great) features of the CRM 4.0 Workflow engine we can do this with very little effort – and without the need to write any code.

Using this approach, you can take the concepts I am about to step you through and apply it to any other Entity that you want to track changes against. The only thing to consider here is that you do not have available to you in the Workflow tool is the value of the attribute before it was changed – so if you do not require an audit of the ‘before and after values’ then this works a treat! Of course if you did want the before and after values recorded together in the same audit record you would need to develop a custom Plugin to do that.

Step 1: Create the CRM Entity to hold the audit records.

In our example we will want to create a record of Opportunity changes so we will create an Entity.

Attributes have been added to this Entity to reflect the information we want to capture about changes a user makes.

A ‘Parental’ relationship has been established between this Entity and the Opportunity.

The Form has been modified to make the necessary fields visible and also to ‘lock’ the fields so that they and not editable.

Also, the Associated View has been updated to include appropriate attributes so it is easy to see what has changed.

guy1

Step 2: Create the Workflow Rule to automatically create a new audit record

Create an Organizational workflow rule, based on the ‘Opportunity’.

Guy2

Select which ‘attributes’ will cause the workflow rule to execute when a user changes any one of them.

guy3

Add a single statement (action) in the workflow rule to ‘Create a Record’ in the Opportunity History entity.

guy4

Click on the ‘Set Properties’ button to set the substitution variables that will be used to create the record.

guy5

Step 3: Publish the workflow rule and test your work

Looking down the list of entries you can easily see what has changed over a period of time.

guy6

The above is a very simple (but effective) example of the new workflow capabilities.

Be adventurous, try building on this simple example and try some of your own ideas out.

Guy Riddle

Dynamics CRM MVP

We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!