Category Archives: Dynamics CRM

Tips and techniques I've collected while working with Microsoft Dynamics CRM 3.0

Dynamics CRM Error of the Day: Internal error: Server stack limit has been reached

Hi Everyone,

Here is a new error condition I thought I’d let you know about.

One of my customers purchased my SnapShot! documentation tool and was receiving Generic SQL Server errors on what appeared to be the simplest queries.

After looking at the platform trace, I see this error message:

Exception: System.Data.SqlClient.SqlException (0x80131904): Internal error: Server stack limit has been reached. Please look for potentially deep nesting in your query, and try to simplify it.

What in the heck does that even mean?

After a small amount of searching, I ran into this Microsoft KB article.

It seems that the error was corrected in individual rollups for both SQL Server 2012 SP1 and SP2.

Root Cause

This was probably caused by a GINORMOUS SQL Case statement. This particular customer has what I am fairly certain to be the largest number of custom entities ever added to Dynamics CRM and SQL Server was having issues when creating a query that looks like this:

SQL to query SystemForms
  1. select
  2. top 251 coalesce("LL0".Label,"systemform0".Name ) as "name"
  3. , "systemform0".Type as "type"
  4. , "systemform0".FormId as "formid"
  5. , "systemform0".ObjectTypeCode as "objecttypecode"
  6. , coalesce("LL1".Label,"systemform0".Description ) as "description"
  7. , "systemform0".IsDefault as "isdefault"
  8. , "systemform0".FormXml as "formxml"
  9. from
  10. SystemForm as "systemform0"
  11. left outer join LocalizedLabelView as "LL0" on ("LL0".ObjectId = "systemform0".FormId and "LL0".LanguageId = 1033 and "LL0".ObjectColumnName = 'Name' )
  12. left outer join LocalizedLabelView as "LL1" on ("LL1".ObjectId = "systemform0".FormId and "LL1".LanguageId = 1033 and "LL1".ObjectColumnName = 'Description' )
  13. where
  14. ((("systemform0".Type != 4 or "systemform0".Type is null) and ((("systemform0".Type != 3 or "systemform0".Type is null) and ("systemform0".Type != 8 or "systemform0".Type is null))))) order by
  15. case "systemform0".ObjectTypeCode when 10000 then 'New Entity'

Don't forget: Dynamics CRM JavaScript Development workshop registration closes on Friday

Hi Everyone,

Just a reminder that registration for next week's workshop: Dynamics CRM JavaScript Development closes on Friday, so now is the time to register.

The goal of the class is for me to give you a very thorough introduction to using JavaScript within Dynamics CRM.

This will be my last live training event of the year.


Tuesday, August 30th and Wednesday, August 31th. 8:00am-4:00pm each day


Online using GoTo Meeting


This is a hands-on workshop with each student


$697 per person (multi-student discounts available)

Eventbrite - Dynamics CRM JavaScript Development (August)


Note: Due to the interactive nature of this workshop, it will be limited to 15 students.

Student Prerequisite Knowledge:

  • Each student must have working knowledge of Dynamics CRM.
  • Knowledge of JavaScript is also required.


The majority of our time will be spent actually developing JavaScript solutions for Dynamics CRM.

Think labs. Lots and lots of labs. And homework. There will be homework.

We'll cover the following topics:

Setting up your JavaScript development environment

The first thing we need to do is to get everything installed and configured that will make us succeed as a Dynamics CRM Developer. We’ll discuss the free and commercial tools and services available, JavaScript libraries that will increase your developer productivity, and other development best practices when working individually or in a team environment.

Introduction to the Dynamics CRM JavaScript Object Model

The Xrm.Page object model that we use for Dynamics CRM JavaScript development is quite comprehensive.  We’ll discuss the major components and objects, and the following major topic areas:

  • Working with Collections
  • Data operations
  • Tabs and Sections
  • Working with Controls
  • Working with iFrames
  • Working with Navigation Items

Working with JavaScript Libraries and Forms

JavaScript that we use within Dynamics CRM is stored in web resources. We’ll discuss this model, connecting to the data entry form, and wiring up the event model.

Data Operations and the new Web API

Creating, reading, updating , and deleting Dynamics CRM data is a very common occurrence. We’ll discuss the major JavaScript libraries available to aid your development efforts as well as cover the tools and techniques required to work with the new Dynamics CRM 2016 Web API to perform database and platform operations.

Working with the Ribbon

There are several Ribbon-related interfaces available to us as JavaScript developers and we’ll work with some of them so that you can see where they can be useful which may help add additional functionality to your projects.

Utility Methods

We have some fairly useful utility methods used for opening Dynamics CRM Forms and Web Resources via JavaScript. There are several tricks and tips that I’ve learned that we’ll be discussing and working with.


So that about covers everything. As mentioned, we’ll have tons of labs, samples, libraries, etc. so it just be a pretty packed couple of days.

If you have any questions, please let me know.

Thanks, Mitch

My new book, Dynamics CRM Deep Dive: Administration is in pre-release

Hi Everyone,

I am finishing up the final details for my new book, Dynamics CRM Deep Dive: Administration.

It is currently in pre-release at and I hope to have the process complete around the first week of September.

Here is the table of contents:

Chapter 1.    Create Your Administrative Toolbox
Chapter 2.    Let’s Do a Little Housekeeping
Chapter 3.    Error, Warning, and Notification Messages
Chapter 4.    Managing System Jobs
Chapter 5.    System Job Management: Registry and Database Settings
Chapter 6.    Creating System Management Views
Chapter 7.    Automating System Job Cleanup
Chapter 8.    User Management Tips and Tricks
Chapter 9.    Email Management
Chapter 10.    Email Management – Preventative Maintenance
Chapter 11.    Outlook Sync Table Cleanup
Chapter 12.    Monitoring the Windows Event Log
Chapter 13.    Platform Event Tracing Overview
Chapter 14.    Enabling Event Tracing
Chapter 15.    Troubleshooting Using Event Tracing
Chapter 16.    Matching User Error Codes
Chapter 17.    Troubleshooting Development Errors
Chapter 18.    Workflow Best Practices
Chapter 19.    CRM SQL System Jobs
Chapter 20.    CRM Organization Settings Editor
Chapter 21.    Creating a Management Dashboard
Chapter 22.    Email Router Troubleshooting
Chapter 23.    SCOM Management Pack for Dynamics CRM
Chapter 24.    SQL Server Indexing
Chapter 25.    Backups, Backups, Backups
Chapter 26.    CRM Diagnostics Page
Chapter 27.    Problems with Security
Bonus Material


Drop me a line if you have any questions.

Thanks, Mitch

Dynamics CRM Security: Crossing your I’s and Dotting your T’s

I learned an important lesson, again, for making sure you have all of your facts.

This is often referred to, in English, as “Crossing your T’s and dotting your I’s.” (my blog title is just a twist on that to confuse people and get them to read this article. Smile )

Rule #1: Never Assume

What was my lesson learned? Never assume.  I should know this by now; heck, we should all know this by now.

But assume is what I did, and it took me way longer to discover the truth than it should have.

The Scenario

I configured Hierarchical Security for one of my customers to fit a business requirement. After some initial struggles with comprehension and implementation, it was working the way that the documentation says it should.

Then it wasn’t working like the documentation said it should.

People could see records (mostly activities, in this case) that were very much outside of their area and it made it seem like the whole Hierarchical Security feature was broken.

I reviewed all of the user settings and security roles, but indeed, logged in as a normal user, I could see activities that were not theirs.

The Chase

Running out of other options, I called my friend Scott Sewell and we discussed the options, I ran security reports using my SnapShop! utility, and we looked at the Principle Object Access table, and still didn’t see how in the world this user could see these records.

Then Scott said:

Are there any security roles assigned to any teams he is a member of?

“No,” I said. “We don’t have any teams for users like him.”

But just to be safe, I went a looked.  Sure enough, no teams were assigned; but he was a member of the business unit team since everyone is a member of the business unit team.

Surely there are no security roles on the business unit team.  Or are there?

The Solution

Just to be safe and cover everything, I opened the business unit team, clicked on Manage Roles, and what did I find?

Not one but TWO security roles.

These two roles totally circumvented all of my carefully crafted security for this user and gave him unprecedented access to other records.

I removed the two roles, refreshed the activity view, and the records previously visible, were suddenly, and appropriately, no longer visible.

Lesson Learned

I am working with another partner on this customer and there were several cooks in the kitchen, so to speak.

Never make any assumptions about configuration just because YOU didn’t do something.

Free Webinar Friday: Introduction to Dynamics CRM Project Service Automation

This week’s webinar:

Introduction to Dynamics CRM Project Service Automation

Friday, Jul 29, 2016 10:00 AM Central Time (U.S.) (GMT-5:00)   Register here

In this webinar we will review the installation and configuration of the new Project Service Automation feature available for Dynamics CRM Online (Spring Release).

Announcing the August Dynamics CRM Developer Bootcamp

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 the Dynamics CRM Developer Bootcamp.

This course provides an introduction to the technologies, tools, and processes required to turn a .NET developer into a Microsoft Dynamics CRM developer. In–depth coverage is provided for both client and platform technologies through the use of real–world lab scenarios. Students will also be exposed to the most current third–party tools to aid them in their development efforts and finally, each student will receive a collection of templates and code–libraries to jump–start their development efforts.

Is this course for me?

If you are a developer who is just starting your journey into Dynamics CRM development and who needs to gain an understanding of the technologies, processes, and tools required to be a Dynamics CRM developer, then the answer is Yes!

Likewise, if you have been thrown into Dynamics CRM development (either voluntarily or kicking and screaming) and need to fortify your knowledge, then this course is also for you.

Sounds great! Sign me up!

What you will learn:

The information covered is relevant to Dynamics CRM versions 2011 through 2016 (though some topics are specific to one version or the other). Here is what we cover:

  • Using the Dynamics CRM SDK with .NET to perform platform and query operations
  • How to create plugins and custom workflow activities
  • How and when to use the Dynamics CRM JavaScript object model
  • How to edit the Dynamics CRM SiteMap and the Ribbon components
  • How to create and use solutions effectively
  • You’ll also learn where to find, and how to use, the free tools available for both Dynamics CRM developers and administrators

Sounds great! Sign me up!

Your instructor:

This class is taught by Mitch Milam, ten–time Microsoft Most Valuable Professional for Dynamics CRM and an independent consultant specializing in Dynamics CRM architecture, development, and training.  This is your chance to learn from someone who has been developing with Dynamics CRM on a daily basis since Dynamics CRM version 3.0.

The dates:

In order to make as small an impact on your work week as possible, the class will only be running for a maximum of four hours per day, so that we can all get our normal work done.  Here is the schedule:

Week 1:

Monday, August 1st, 1:00pm-5:00pm CDT

Introduction to the Dynamics CRM architecture and extensibility points
Basic SDK Operations (.NET)

Tuesday, August 2nd, 1:00pm-5:00pm CDT

Query Technologies: Using QueryExpression, QueryByAttribute, FetchXml, and LINQ (.NET)

Wednesday, August 3rd, 1:00pm-5:00pm CDT

Creating plugins

Thursday, August 4th, 1:00pm-5:00pm CDT

Creating custom workflow activities

Week 2:

Monday, August 8th, 1:00pm-5:00pm CDT

Working with the SiteMap and the Ribbon

Tuesday, August 9th, 1:00pm-5:00pm CDT

Working with Solutions

Wednesday, August 10th, 1:00pm-5:00pm CDT

Introduction to the Dynamics CRM JavaScript Object Model

Thursday, August 11th, 1:00pm-5:00pm CDT

Advanced Dynamics CRM JavaScripting techniques including using the Web API to manipulate Dynamics CRM data


This is a developer course so you must know:

  • Visual Studio, .NET and C#
  • Have a familiarity with the Dynamics CRM product
  • Passing familiarity with JavaScript

Course format:

This is an Internet-based workshop. Classroom time and discussions will be facilitated using GotoWebinar and we will be using Dynamics CRM 2016 Online  for our development environments. This will allow for the completion of labs and homework without causing conflicts with the other students.

The investment:

The investment for a standard developer ticket is $2,995.

The standard developer ticket with an additional four hours of follow-on coaching is $3,495.

Discounts are available for multiple students and a payment plan is also available to help spread the cost.

Sounds great! Sign me up!


Students will also receive the following tools and resources, valued at over $500. Here is what you get:

  • Single-organization license for SnapShot! for Dynamics CRM
  • Electronic copies of my Deep Dive book series: Plugin Development, Administration, Security, and Query Strategies
  • Templates and code libraries that I used in my everyday development efforts

New Workshop: Dynamics CRM Upgrade Strategies Deep Dive

I get a lot of upgrade questions and I’ve even done a few webinars on the topic. I thought it would be a good idea to package all that I have learned in the past few years upgrading my customers into a cohesive package that walks through the entire process from start to finish.


In this workshop we'll perform a step-by-step review of the entire upgrade process including:

  • Building your development and testing environments
  • Database cleanup and preparation
  • User training strategies
  • Deployment risks and recovery procedures
  • Tools you should have in your toolbox
  • Performing code reviews and updates (.NET and JavaScript)
  • Analysis best practices

Depending on the audience, we will start with Dynamics CRM version 4 and work our way through the upgrade process to Dynamics CRM 2016.


Tuesday, July 26th, 2016 at 1:00pm (Central Time-US)

Class Duration:

3-4 hours

Cost Per Attendee:


Note: Due to the interactive nature of this workshop, this session is limited to 15 attendees.

Register Here:

Eventbrite - Dynamics CRM Upgrade Strategies Deep Dive


Note: Registration ends at 5:00pm CDT on Friday, July 22th.


In order to increase their level of success with their upcoming upgrade project, each attendee will receive single-organization licenses of each of my Dynamics CRM utilities:

This is a $ 1,539 value but your free just for attending the class!


Let me know if you have any questions: mitch at xrmcoaches dot com