NAV/CRM Dynamics Connector – Error – Object reference not set to an instance of an object

I got this error today

NAV/CRM Dynamics Connector – Object reference not set to an instance of an object

this was very frustrating because I hadn’t changed anything, literately tried to turn on the connector to make some changes.

I’m not sure what had happened but the connector had got itself into a right mess.  I tried to repair it and it couldn’t write any values to the MSDI database.

It was complaining about the user privileges but the user had admin rights on the machine and the database.

I tried uninstalling and reinstalling but this didn’t work at all because then the service was appearing in the list of services, the database was still dodgy.

In the end to resolve this problem I had to delete the MSDI database in SQL Server management studio.

What I surmise was the problem was the database had for some reason become corrupted and if you don’t delete the database I think it still leaves it there to use, so when I reinstalled the connector it was still using (or trying to) the corrupted database.

I did find a couple of other blog posts which put forward different answers but they seemed like more effort than deleting and starting again (make sure you back up those maps)

but I will paste them below if you need to try them

this one seems quite promising but it didn’t work for me



Microsoft Community Contributor Award – What Is it?

I have seen a impress Community Contributor Award being displayed on some of my favourite CRM bloggers blogs.   I have seen the award on Rhett Clinton’s excellent blog

MSCRM Bing’d

He wrote a blog post on the subject, although it was in Feb, I have only just read it!

Why am I writing about this, well it’s not because I’m about to get one or anything like that but I was curious to see what the award was for and the criteria/method Microsoft used to give these awards out.  The blogs where I have seen the award given, as well as the MVP status is certainly well earned, so I certainly don’t think there is any arguements to who they are giving out the awards to (I’m only basing this on the CRM blogs I have looked at)

if you want to know more about the community award then read the two links below


CRM 2011 – How to change the format for a user

In CRM 2011 there are global format settings which can be specifed by a user with Administrator logon and these are in

Settings –> Admin –> System Settings

These provide the template for new users added to the system.

So when I created an organisation, which got created with English (United States) format.  I then added four users before realising I need to change this to English (United Kingdom).

The problem I had was those four users were created all with the American format.  There doesn’t seem to be a way for an Admin user to change these user settings (using the GUI) which is quite annoying.  You also can’t delete and add users easily because you can only deactivate them (I could in theory remove the Active Directory settings and name the user test and then create new users).  There were no easy options to get round this problem, except do right next time.

So I had to create some instructions to get those users to change those settings and I thought I would share them with you here

Login to CRM

Go to File à Options


navigate to the tab – format and choose your format of choice




CRM 2011 – Free getting started guides for CRM 2011

I saw a good blog post from Business with CRM which is a getting started for Microsoft Dynamics CRM online Administrators. He has brought together some of the links from the CRM resource wiki.  This is a great web page to give to users who will be the Administrators of their CRM system.

The areas the blog covers are

Define business units and security roles

Add users 

Assign users to security roles

Import your data

Install Microsoft Dynamics CRM 2011 for Microsoft Office Outlook

Go here to visit the page and read the details


When looking at the page I remembered the other guides I have blogged about and thought I would list them here

There is also a printable CRM 2011 Administrator’s Guide which has been released.  This is quite a detailed document at 149 pages but the downside is it doesn’t contain any screen shots so can sometimes tricky to follow

Business Users getting started guide

You have this good page on the CRM resources site

Getting Started with CRM 2011 for Business users

user guide for CRM 2011

You can download the CRM 2011 user guide here , it’s quite detailed at over 600 pages long

 customer go live checklist

I think this document was created by Microsoft, it’s quite good and goes through lots of potential things which might go wrong and setting up internet explorer and other things



The bit is all the information above is free.

CRM 2011 – Getting started with customer service processes in Microsoft Dynamics CRM

There was a very interesting blog post on the Microsoft blog this week called Resources for Customer Service it had a link to a couple of articles on the Microsoft Dynamics CRM resource centre, which I think has some of the best articles explaining how to use CRM for new users on the internet.

If Microsoft could arrange these into a user manual it would be fantastic and really help users get up and running with CRM 2011 quickly and easily.  The problem I have at the moment is there are lots of great articles but they are not easy to find unless you search for them.

This is an example of the case workflow on CRM resource centre, it explains it much better than talking or writing about it in my opinion


There are two great resources for CRM 2011 users using the Service section of CRM.

Articles about customer service processes in Microsoft Dynamics CRM Online

Articles about customer service processes in Microsoft Dynamics CRM


below are the contents for the On Premise version, I think it covers a lot of the basic knowledge the user will need to get started and have a good overview of the calls/cases in CRM.


Getting started

9 steps to get started with customer service

These are the nine key things you should know about the customer service features of Microsoft Dynamics CRM, including terminology, quick tips, and using reports.

Read this article…

7 steps to get started with managing services

These are the key things you should know about managing services in Microsoft Dynamics CRM, including terminology, quick tips, and using reports.

Read this article…

Follow the life cycle of a case

Learn how to follow a case from initiating activity to resolution.

Read this article…

Organize and track your activities

Activities are used to track and record your interactions with customers. Follow an activity through a complete life cycle, from creating the activity though closing.

Read this article…

Track work items in queues

Track work items, such as activities or cases, using queues.

Read this article…

Using services

Learn how to manage human and physical resources when creating customer service calls.

Read this article…

Back to top arrow Top

Maximize your productivity

Video: Getting started with cases

This video explains how cases can help you know your customer and provide better customer service. Length: 2:53 minutes

View this video…

Video: Simplify scheduling with services

In this video, you can learn how services can help you schedule service activities for your customers faster and more accurately. Length: 2:35 minutes

View this video…

Video: Improve customer service with contracts

This video introduces you to how contracts and contract lines can help you provide better customer service. Length: 2:18 minutes

View this video…

Video: Organize and centralize articles for your business

This video explains how to make critical knowledge available to everyone in your organization by capturing it in articles. Length: 2:06 minutes

View this video…

Personal customizations

Everyone can personalize Microsoft Dynamics CRM. Know the personalizations that everyone can perform so that you can focus on customizations that affect the entire organization.

Read this article…

How to highlight code in hosted wordpress blogs

This has been something that has been annoying me for quite a while, how do I show c# and javascript code in the blog in a decent way.

The other important factor to note here is I am using a hosted blog, so all the solutions with plugins are no good to me.

Well I finally figured it out thanks to this stackoverflow page here

you put this in your code but make sure you put it in the Visual view and not the HTML. I’m not sure how to type this so I have typed the square bracket rather than putting them in (because then it puts in code)


[sourcecode language='javascript']

here is an example

function customerid_onchange(){
 // Get value of the selected customer account
 var lookupItem = Xrm.Page.getAttribute("parentcustomerid").getValue();

CRM2011 OptionSetId Cannot be Changed when Importing Unmanaged Solution

I had an unusual problem today, I say unusual I mean irritating.

I had a solution which was unmanaged and I had imported it to an organisation.

I then worked on my solution further and at some point I decided some of the Option Sets should change from entity level to global option sets.

When I then exported my solution and tried to import it into the organisation which had an early version.

It failed, it gave the error

OptionSetId cannot be changed when importing

The only useful part of the error message was it told me it was an option set, it didn’t tell me which one.

It took me a while to work out which option set was causing me problems but in the end I removed and deleted most of them until I got the right one.

This forum post was quite useful for pointing me in the right direction.

It certainly is a good argument to use managed solutions rather than unmanaged, the ability to remove the solution before importing sounds very useful (not to mention the customer not being able to change anything).

I thought I would write a blog post about this because when I googled the problem, hardly anything came up.

CRM 2011 – Javascript code to lookup parent customer addresses from contact form

I had written this code before but it is the property of my previous employer.  I could rewrite fairly easily because I have recently done the same thing in CRM 4 based on  code similar to this –

but good news for me and other people out there JoshJWilliams has recently written the code and copied it to this forum post

so well done JoshJWilliams for perserving and solving the problem and thanks for copying the code up for the CRM community to use.

here is the code

function customerid_onchange(){
 // Get value of the selected customer account
 var lookupItem = Xrm.Page.getAttribute("parentcustomerid").getValue();

if (lookupItem != null)

// Lookup Customer info
 var url = '/' + Xrm.Page.context.getOrgUniqueName() +
 + lookupItem[0].type + '&parentId='
 + lookupItem[0].id + '&ShowNewButton=1&ShowPropButton=1&DefaultType=1071';

// shows a modal window to select the addresses
 var selectedAddress = window.showModalDialog(url, null, 'dialogWidth:600px;dialogHeight:400px;resizable:yes');

// Validate address info in not null before continuing
 if (selectedAddress != null)
 var addressFields = selectedAddress.items;
 // we have the id of the address -now use the json to get the values in an array.
 sLookupValue = addressFields[0].id;

var xml = "" +
 "<?xml version=\"1.0\" encoding = \"utf-8\"?>" +
 "<soap:Envelope xmlns:soap=\"\" xmlns:xsi=\"\" xmlns:xsd=\"\">" +
 decodeURI(GenerateAuthenticationHeader()) +
 " <soap:Body>" +
 " <RetrieveMultiple xmlns=\"\">" +
 " <query xmlns:q1=\"\" xsi:type=\"q1:QueryByAttribute\">" +
 " <q1:EntityName>customeraddress</q1:EntityName>" +
 " <q1:ColumnSet xsi:type=\"q1:ColumnSet\" >" +
 " <q1:Attributes>" +
 " <q1:Attribute>city</q1:Attribute>" +
 " <q1:Attribute>country</q1:Attribute>" +
 " <q1:Attribute>fax</q1:Attribute>" +
 " <q1:Attribute>line1</q1:Attribute>" +
 " <q1:Attribute>line2</q1:Attribute>" +
 " <q1:Attribute>line3</q1:Attribute>" +
 " <q1:Attribute>name</q1:Attribute>" +
 " <q1:Attribute>postalcode</q1:Attribute>" +
 " <q1:Attribute>primarycontactname</q1:Attribute>" +
 " <q1:Attribute>stateorprovince</q1:Attribute>" +
 " <q1:Attribute>telephone1</q1:Attribute>" +
 " </q1:Attributes>" +
 " </q1:ColumnSet>" +
 " <q1:Attributes>" +
 " <q1:Attribute>customeraddressid</q1:Attribute>" +
 " </q1:Attributes>" +
 " <q1:Values>" +
 " <q1:Value xsi:type=\"xsd:string\">" + sLookupValue + "</q1:Value>" +
 " </q1:Values>" +
 " </query>" +
 " </RetrieveMultiple>" +
 " </soap:Body>" +
 " </soap:Envelope>" + "";

xml = xml.replace(/:/g, ":");
 xml = xml.replace(///g, "/");

//window.clipboardData.setData("text", xml);
 var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
 xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
 xmlHttpRequest.setRequestHeader("SOAPAction", "");
 xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
 xmlHttpRequest.setRequestHeader("Content-Length", xml.length);

var resultXML = xmlHttpRequest.responseXml;

 var oXmlDoc = new ActiveXObject("Microsoft.XMLDOM");
 oXmlDoc.async = false;


var businessEntities = oXmlDoc.getElementsByTagName('BusinessEntity');
 /*if (businessEntities[i].selectSingleNode('./q1:name') != null)
 } */

for (i=0; i< 1; i++)

if (businessEntities[i].selectSingleNode('./q1:name') != null)

// Address Name Set

if (businessEntities[i].selectSingleNode('./q1:city') != null) {
 // Address City set

if (businessEntities[i].selectSingleNode('./q1:country') != null){
 // Country set

if (businessEntities[i].selectSingleNode('./q1:line1') != null){
 // Address Line 1 set
 if (businessEntities[i].selectSingleNode('./q1:line2') != null){
 // Address Line 2 set

if (businessEntities[i].selectSingleNode('./q1:line3') != null){
 // Address Line 3 set

if (businessEntities[i].selectSingleNode('./q1:postalcode') != null){
 // Address ZipCode set

if (businessEntities[i].selectSingleNode('./q1:stateorprovince')!= null){
 //Address State set

}// end if entity not empty
 }// end for i++

}// end if no address selected
 } // end of if no customer seelcted
 // end of new address selected function

CRM 2011 – Error changing Sales Pipeline Funnel Chart

I tried to adjust the Sales pipeline chart today to use a different value to funnel because I was currently getting one big blue funnel.  I would say before I go that this might be fixed in CRM rollup 5 upwards because they did improve the functionality of the graphs.


I tried to change the field from Pipeline phase to Process Code but then when you try and save the report the error below appears

I found the answer to the problem on a forum

basically you need to export the chart, open the xml and change the variable stepname into

You just need to replace “stepname” with the name of your custom field. For example, if your field is called new_salesstage, the order element would look like this:

<order alias=”stepname ” descending=”false” />

To (or whatever the name of your field is)

<order alias=”salesstagecode ” descending=”false” />


You should

and finally you should see the fixed pipeline












Microsoft Dynamics CRM 2011 Entity Relationship Diagrams

When you start off developing with CRM 2011 it can take you quite a while to understand how all the entities are related to each other.

So something which would have helped me is an Entity Relationship diagram and then now that I have a pretty good idea how it is all linked together I finally find one.

The good chaps at Microsoft have created one and you can download it here

The download contains a visio file for all the major areas in CRM.  Actually looking at the list it seems a bit confusing


Case Contract



Customer Server


Knowledge Base


Product Catalog