Dynamics CRM 2015 Spring: Plugin Trace Log

Yay! Finally, the good folks on the Dynamics CRM team have added the ability to log errors that occur in plugins and custom workflow activities.

Plug-In Trace Log

This is a new entity that we can access from the Settings, Customization area:




You need to enable the logging of exceptions to the plug-in trace log entity. Navigate to Settings, Administration, System Settings, then select the Customization tab.


Change the Enable logging to plug-in trace log setting to Exception.


Any time you have an unhandled exception in your plug-in or custom workflow activity, a log will be written to the trace log:


The detail looks like this:


Final Thoughts

This is a huge advance for those of us who develop with Dynamics CRM. Prior to this feature, we found I very difficult to record exception information, especially in CRM Online because any record we recorded to a logging entity was erased and when the transaction was rolled back, which was the common occurrence when exceptions were encountered.

This new entity and feature will be a most welcome addition.

Dynamics CRM 2015 Spring: New Forms Engine

The Spring Release of Dynamics CRM 2015 includes a new forms engine. You may have seen reference to this feature by the code name “Turbo Forms.”

The propaganda (marketing) says that we will get as much as a two or three times improvement in the rendering of a Dynamics CRM 2015 form.  My limited testing has not proven this statement but I can say that it is indeed faster.  I have a feeling that speed improvements will depend 100% on the contents of your form.

Let’s walk through the testing process.

Test Using Legacy Forms

The first test will be using the legacy forms to see what the original speed would be.  Perform these steps:

Test Setup

1. Clear your browser cache.

2. Navigate to Settings, Administration, System Settings.

3. Scroll to the bottom of the dialog and change the setting Use legacy form rendering to Yes:


4. Click OK to save your change.

Perform a Test

To perform the actual test, follow these steps:

1. Open a record such as an Account.

2. Press Ctrl+Shift+Q. This will open up the built-in and super-secret Performance Center tool.


3. Click the Enable button.

4. Refresh the web page (F5).

5. Press Ctrl+Shift+Q to display the Performance Center. This time, it will look something like this:


6. Click the very last flag on the right side of the Performance Center Window.

The text window below the graph will display something like this:


As you can see, it took a little over six seconds for all steps, including the loading of the sub-grids to occur.

Test Using New Form Renderer

To test using the new form renderer, perform these steps:

Test Setup

1. Clear your browser cache.

2. Navigate to Settings, Administration, System Settings.

3. Scroll to the bottom of the dialog and change the setting Use legacy form rendering to No:

4. Click OK to save your change.

Perform a Test

Repeat the testing steps performed earlier.

In my test, I see the following results:


The Results

So 4.4 seconds is not a 2x or 3x speed improvement but it is better than the previous form model. In addition, the form appears  to load faster.

One final caveat is this is a pre-release environment which, to my understanding, does not use the same hardware as production CRM Online.  This will probably mean that the speed will increase when the Spring Update finally reaches production release.

Final Thought

I’ll have a more in-depth article on the Performance Center soon.

Convergence Wrap-Up

This year’s Convergence conference in Atlanta was a blast.  Lots of new announcements for both the Dynamics product line as well as that of Azure.

In case you missed it, you can access many of the sessions in the Convergence Video Library, which I urge you to review as your time permits.

Convergence 2015 EMEA

Will be held in Barcelona, Spain on 30 November – 3 December 2015

Convergence 2016

Will be in New Orleans, Louisiana, USA, on April 4-7, 2016

Convergence 2015 (Atlanta) anyone?

Hi Folks,

If you are going to be in Atlanta, Georgia next week for Convergence 2015, please let me know.

I’ll be working in the Microsoft booth at these times:

  • Monday: 12-2
  • Tuesday: 3-5
  • Wednesday: 2-4:30

And I’ll be participating in at least one of the two Ask the MVP sessions:

If you are attending Convergence, look me up.  I’d love to hear what you are doing with Dynamics CRM.

Thanks, Mitch

Xamarin.Forms: Solving the mystery of Grid.Children.Add(left,right,top,bottom)

The Xamarin.Forms Grid layout has three methods for adding Child views to the grid. Two of them allow you to specify the location:

Children.Add(left, top);

Children.Add(left, right, top, bottom);

The first variant is fairly simple: It just takes a column and a row. 

But the second variant, is a little more complicated.  It was probably not meant to be complicated, but due to the naming of the parameters and the lack of documentation on this particular method, makes its use non-intuitive.  I even filed a bug because it was not doing what it says it is supposed to do – or so I thought.

It turns out that it does indeed work properly, assuming you know what the parameters actually mean.  Here is what the method actually needs:

Children.Add(left, right, rowSpan, columnSpan);

We actually had a conversation about this issue a few months back on the Xamarin forums and Till Ballendat gave a great explanation as to the proper use of the method and offered an alternative method extension to make it easier to visualize.  Here is his solution:

public static void AddChild(this Grid grid, View view, int row, int column,

int rowspan = 1, int columnspan = 1) { if (row < 0) throw new ArgumentOutOfRangeException("row"); if (column < 0) throw new ArgumentOutOfRangeException("column"); if (rowspan <= 0) throw new ArgumentOutOfRangeException("rowspan"); if (columnspan <= 0) throw new ArgumentOutOfRangeException("columnspan"); if (view == null) throw new ArgumentNullException("view"); Grid.SetRow((BindableObject)view, row); Grid.SetRowSpan((BindableObject)view, rowspan); Grid.SetColumn((BindableObject)view, column); Grid.SetColumnSpan((BindableObject)view, columnspan); grid.Children.Add(view); }

This came up again this week and with Till’s permission, I’m posting it here for a bit better visibility should others run into the issue.

Upcoming Developer Workshop: Extending Dynamics CRM

Just a reminder that my development workshop, Extending Dynamics CRM class, will be held Monday, March 9th through Friday, March 13th.

Course Description:

If you are looking to get started with Dynamics CRM development, and are looking for an instructor-led, hands-on workshop, then let me introduce you to Extending Dynamics CRM.

In case you did not know, Microsoft decided to only offer the Extending Dynamics CRM course via eLearning, starting with Dynamics CRM 2013. eLearning, which is a self–study program, is great for many people, but I think students gain a tremendous amount of learning and understanding from having an instructor who works with Dynamics CRM development on a daily basis. This student-instructor interaction combined with the ability for the student to ask questions and obtain clarifications, makes this course all the more valuable.

Download a PDF version of this document here.


This class is taught by Mitch Milam, nine–time Microsoft Most Valuable Professional for Dynamics CRM and an independent consultant specializing in Dynamics CRM architecture, development, and training.


We have taken the topics normally covered by the official Microsoft Extending Dynamics course, and expanded their depth quite substantially. Instead of a three–day course, this is a five–day course with most of the extra content being the addition of a large number of hands–on labs. The information covered is relevant to both Dynamics CRM 2013 and 2015.


Monday, March 9th through Friday, March 13th.

Class starts at 8:00am CST and will last five or six hours per day, depending on the topic. Please budget the entire day so that you have time to complete the homework assignments.


This is an Internet-based workshop. Classroom time and discussions will be facilitated using GotoMeeting. Each student will be given their own virtual development environment for the duration of the course. This will allow for the completion of labs and homework without causing conflicts with the other students.


$1,995 per student.

Discounts are also available for two or more students.

Note: Due to the hands–on nature of this workshop, there is a limit of 12 students per class.

Eventbrite - Extending Dynamics CRM (March)


For more information visit:


Correcting Filtered Views and an Inaccurate “First ten” list

I ran into a situation at one of my customers while performing an upgrade from Dynamics CRM 2011 to 2015. On several of their entity forms, they have a filtered lookup in place where one value is filtered based on the value of another field. In this case it is an Account/Contact set of fields, which looks like this:


The idea is that the Primary Contact lookup will be filtered to show only contacts associated with the Potential Customer. This is accomplished with the following settings on the Primary Contact field:


How this works

Here is how this set of settings works:

1. You first check the Only show records where checkbox,

2. Then set the first field to use the Potential Customer (Accounts) (Quotes) value.

This setting is a little confusing, so here is my interpretation:

Potential Customer = the Potential Customer field.

(Accounts) = look for Accounts. This field can also contain Contacts.

(Quotes) = I am guessing this means the quotes entity.

3. The second setting instructs the lookup to look for Contacts where the Company Name field of the Contact is the same as the Potential Customer field.

The Problem

The problem is that it does not seem to be working the way I think it should. When you first click on the magnifying glass icon, you will get a list of 10 contacts, that seem to be unrelated to the Account specified in the Potential Customer field, as you can see below:


If you scroll to the bottom of the list, and click on Look up more records, you will see the standard lookup dialog which is properly filtered:


This confuses the user quite a bit and makes them do extra work. 

The Solution

At this point, I am under the impression that this is a bug. The list of 10 items needs to be the same as the items shown in the actual lookup dialog.  This means we have to resort to a little JavaScript.

Add this code to the JavaScript library associated with your entity:

function preFilterPrimaryContactLookup() { Xrm.Page.getControl("new_primarycontactid").addPreSearch(addPrimaryContacLookupFilter); } function addPrimaryContacLookupFilter() { if (Xrm.Page.getAttribute("customerid") == null) { return; } var customer = Xrm.Page.getAttribute("customerid").getValue(); if (customer == null) { return; } fetchXml = '<filter type="and">' + '<condition attribute="parentcustomerid" operator="eq" value="' +

customer[0].id + '" />' + '</filter>'; Xrm.Page.getControl("new_primarycontactid").addCustomFilter(fetchXml); }

The first method, preFilterPrimaryContactLookup, simply adds what we call a Pre-Search condition to the Primary Contact field. That condition actually calls the second method, addPrimaryContacLookupFilter, to actually do the work.

addPrimaryContacLookupFilter extracts the ID of the Potential Customer, then creates a FetchXml Filter Condition where the Contact entity is filtered based on where the Parent Account (parentcustomerid) of the Contact is the same as Potential Customer of the Quote (in this case).

We finish this exercise by adding the following line to the form’s OnLoad event:



As I mentioned, I think this is a bug. I’ve seen it happen and not happen with different versions of Dynamics CRM 2015.

If you are trying to implement this technique, start with the standard configuration of the field, using the field properties in the form editor and if that does not work as you expect, add the JavaScript.

System-Wide Alerts in Dynamics CRM 2015

Dynamics CRM 2015 implemented a new system-wide alerts to inform you of issues with things like the Server-side Sync process. They appear in the user interface as a yellow bar at the top of the page, as you can see below:


Clicking the View Alerts button will take you to the Alerts view where you may review the individual alerts.

At this point I am not certain what will be alerted on, besides issues with Server-Side Sync, but those for sure are there.

Viewing Alerts

The actual Alerts view is on the Dynamics CRM user interface at the end of the Sales Area:


The rather fascinating thing about Alerts, is that they are not actually Alerts, they are Traces.  So, when you are working with Advanced Find, you need to use the Traces entity.


Programmatic Access and Automation

The Traces (Alerts) entity is actually called TraceLog, which is the entity name to use when writing code using the Dynamics CRM SDK.

Traces are fairly locked-down so here are some of things you can do with the entity:

  • Create a workflow to trigger on the Traces entity
  • Perform a query using Advanced Find
  • In the SDK TraceLog is listed a “internal use only” but it appears you may use the SDK to perform standard CRUD operations.  NOTE: I have not tested this.


Privileges for the Traces entity are found on the Core Records tab:


It would appear that everyone can Create, Read, and Append Trace records, but only the System Administrator role can delete them.  Since these are standard security roles, you should be able to change these settings if you wish.


Traces are a very interesting addition to the Dynamics CRM platform and I need to get more information from Microsoft as to its intended use and if we as developers can actually create alerts that may be seen by the System Administrator.

That will be my next step, when I have time.

Sharing information and lessons learned with other developers

Sign up for our new KnowledgeBits service and get news, tips and tricks and more, delivered straight to your inbox.