Friday, October 23, 2009

Could not find GUID for server...

Interesting error today.

All of a sudden our development server stopped working. We got the following error in CRM:
Microsoft CRM Error Report:

Error Details:

Could not find GUID for server: CRMSERVER$

Full Stack:

[ActiveDirectoryObjectNotFoundException: The local computer is not joined to a domain or the domain cannot be contacted.]

at System.DirectoryServices.ActiveDirectory.Domain.GetComputerDomain()

at Microsoft.Crm.BusinessEntities.SecurityUtils.GetGuidFromServerName(String serverName)...
It seems that it was caused by the fact the the domain servers DNS was down. I have read of other causes for the same error, but make sure that the DNS service of the domain server is up and running.
Gustaf Westerlund
Microsoft Dynamics CRM Chief Architect


Tuesday, October 20, 2009

SharePoint 2010

The NDA of the new version of SharePoint 2010 has been lifted and hence a lot of new functionality is out!

You can read a lot about it on the SharePoint Team Blog here:

From a CRM perspective, this is very interesting. The new version of CRM is rumored to have a much tighter integration with SharePoint, so from that perspective it is almost essential to learn a bit more about SharePoint.

There are some areas of SharePoint that are of special interest from a CRM perspective:
  • Enhance BI functionality including performance Point server now included in the new SharePoint
  • Business Data Catalog enhanced - an excellent tool to work with in relations to CRM
  • Enhanced Document Management - one of the weaker parts of Dynamics CRM 4 is the built in document management so integration with SharePoint in regards to document management is often used.
  • Enhanced API and development capabilities. When integration with SharePoint development is often required to create the necessary functionality. The SharePoint API is currently ok but compared to the excellent API of Dynamics CRM, it can do with an upgrade. Hopefully to the mark set by Dynamics CRM.
So that is all good news.

However, there is still one major issue from a CRM - SharePoint integration perspective that Microsoft REALLY need to address and that is the licensing issues of SharePoint users working in a very slight way with CRM data by, for instance, looking at data from a data warehouse in SharePoint with drill-down functionality. Today, all users with access to this need to have a full read only CRM license. Similarly, if there is a webpart used in SharePoint to create leads in CRM, but with no other need for access, a full CRM CAL is required for all users of the Intranet since they are employees and hence cannot use the external connector license. This is preposterous! Please Microsoft, we really like CRM, and we want to pay our dues, just make it fair!

Gustaf Westerlund
Microsoft Dynamics CRM Chief Architect


Sunday, October 18, 2009

Strange problem with Country and Country Code

A couple of days ago I had the wierdest error. We have added some fields on Acccount and a new entity called Billing Account so that there is Contry and Country Code in both. The wierd thing was that when I opened the tab with the field, after about 1 second, the country changed to "United States" and the country code to "1". This even happened to the custom entity.

I was confused. The country code was supposed to be according to the so and so ISO standard, where Sweden is SE. Hence 1 was very incorrect. I started looking if some tired programmer might have added some javascript or similar but found nothing out of the ordinary. Then I though I'd just like to see what happens when I run IE directly from the CRM server, and praise and behold, it didn't change the field! That narrowed it down. First I thought it was google Toolbar, so I uninstalled it, but the error was still there. Then I tried running IE in InPrivate surfing and then it didn't change it! So, there must be some plugin in IE that causes it. After some uninstalling and testing I found it, Swedbank has this "e-kort" or e-card program that let's you generate a one-time VISA number, this was the program that caused this error. It is probably some program this Swedish bank has bought from some american company and it has this weird feature.

Well, that just teaches you, don't install a lot of crap into IE. :)

Gustaf Westerlund
Microsoft Dynamics CRM Chief Architect


Create replacement entities

Sometimes, using a standard entity like product or invoice might not be the most optimal choice. Often due to the fact that there is quite a lot of business logic built into these entities. Therefore it is somtimes better to create you own entity instead. However, if you try to create a new entity with the name "Product" you will notice that it cannot be done since there already is an entity with that displayname.

The solution is quite simple, change the displayname of the built in product to "Old product" and remove all rights for all users to it and it will disapear for all normal users. You can then create your new entity with the displayname "Product".

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Friday, October 16, 2009

CRM Customization Manager

My colleague Daniel Halan, has developed a very useful tool for handling customization files. As you might know, the standard tool for this is a bit limited so there is a need for this kind of tool.

Daniel writes a bit more about it on his blog:

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Friday, October 02, 2009

Off topic: P1i playlist creator

This is a bit off topic but I thought that some of you might be interested anyway. If you don't have a Sony Ericsson P1i or similar, you can stop reading now.

I like to listen to audio books on my Sony Ericsson P1i but it is a bit problematic since the phone doesn't support normal playlists with relative addresses and you cannot select a directory and play all files in the directory either. This is problematic when you have an audio book that you have ripped from your bought CD box since you don't want to play the tracks in any order.

The phone also requires the absolute path of the playlist to use the drive "D:" and nothing else. This is very strange and I think it is a big flaw with an otherwise good phone.

To ease my troubles I created a small program that can create the m3u files in the correct format to support the P1i and I don't see any reason why I shouldn't share it since it only took an hour or two to create.

Just copy the directory with the mp3:s to the memory stick and run the program and select the directory and enter a fitting name for the m3u file and click run. The m3u file is created. Enjoy.

Not much CRM or SharePoint but it's free! Right?

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Friday, September 11, 2009

VPC:s and Shared Networking

I used VPC:s all the time and we often clone VPC:s to all project members. However, there is a very tricky part of VPC:s and Microsoft CRM environments and this concerns SID:s.

As you might know, each windows machine has a SID, which is supposed to be a unique identifier for the machine. Exactly when it is used, I am not certain of but I know that you can get into a whole lot of strange trouble if you have two computers with the same SID on the same LAN.

It can easily be changed on any normal windows machine or server with forinstance the tool newsid. However, there is one type of machine that you cannot change SID on and that is a domain controller.

To ease the managing of normal VPC:s it is usually best to create VPC:s that contain everything in one. That is, Windows server, Domain controller, SQL Server, Reporting Services, Visual Studio 2008 and, of course, CRM.

So, we have several VPC:s that have the same SID and we have people sitting next to eachother running them at the same time. The only network setting that can be selected, to still conect to the internet in the VPC is hence, Shared Networking.

This setting is actually a small local network in it self with a NAT (Network Address Translation)/ DHCP server/switch in the VPC host program.

I noticed a problem today when I started up a VPC and noted that I had forgotten to connect the network cable. After I had inserted the network cable and my host PC had full access, I still had problems getting an IP address and a propper connection to the internet from my VPC.

After some fiddeling with trying to run ipconfig /release, ipconfig /renew and sleeping the VPC, I finally shut down the host program and opened the VPC again after which I ran ipconfig /renew, finally it worked.

My interpretation of this is that the NAT/DHCP server need to have a working network connection in the VPC to intitialize properly. Since I didn't, it just miss started and my VPC:s never got any proper IP:s. The only possible way of restarting it is to restart the VPC host program. After it has been started, you just have to run ipconfig /renew to get a new IP from the VPC DHCP/NAT server.

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Wednesday, September 02, 2009

Problems with referenced assemblies in plugins

Plugins are a very useful technique and can be used to lots of different things. But sometimes things don't work like you expect them to...

Here at Logica Sweden we have developed a CRM Framework with lots of nice tools to aid your everyday CRM development. The architect behind this hasn't been me but my fellow CRM architect Daniel Halan. This framework is contained in a dll and it is used in plugins.

The problem I was facing was that when I updated the framwork and rebuilt my plugins, to the assembly directory, it also put the framework dll in this directory. But when I tried to run it I got the most weird errors saying that it could not find methods, constructors and similar. If I installed the framework dll in the GAC then it would all work fine. This is something that I would like to avoid, however, since it is a bit cumbersome when developing.

After some collective debugging we found the error, plugins don't use the dll:s in the assembly directory, but the dll:s in C:\Program Files\Microsoft CRM\CRMWeb\bin (or similar depending on where you have installed CRM).

So, make sure you put your referenced dll:s in the correct directory and happy coding!

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Tuesday, July 07, 2009

One of my managers is number 9!

I read David Jennaway's blog today ( and he was happy that he was listed at 100 on the list of the most influential Dynamics Professionals in the World. I had a look through the list and found that the head of our "Microsoft Empowering Team" at Logica (I represent Dynamics CRM in this team) and also the head of our Dynamics Practice globaly, Thomas Olfsson at position nr 9 in the entire world!

Have a look at the list you self here:

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Friday, June 05, 2009

Workflow scope and security roles

When creating workflows there are some things that have to be taken into account. One thing that you might not know the details about is the Scope in "Options for Automatic Workflows". There are four options that are very similar to the options used for setting up security roles. They are:

- User
- Business Unit
- Parent: Child Business Unit
- Organization

Bellow the selection of the scope, there are some workflow triggering options, like starting the workflow when on create or when an attribute has changed.

The meaning of this is that dependent on the scope you have selected, the triggering will be set up, based on the user who owns the workflow.

So, for instance, if I select "User" in scope and then select triggering on attribute change, and I am the owner of the workflow, then it will only trigger when I make a change to the object.

If scope is set to Organization, it will trigger for all users in the tennant which is why this is most often used. Note however that user is set as default, so you'll have to change this when creating the workflow if you want it to work for someone else than yourself.

This is a useful tool since it can allow powerusers to create their own workflows to help them with their work without actually enabling this for everyone else.

As I have mentioned earlier, the workflow functionality is very powerful, and even thought there are protections agains infinite recursions and such, there is still the risk that semi skilled powerusers creating workflows that put a heavy load on the asyncservice, so I would be a bit reluctant on letting them use this. Thorough training is a must before and try to teach them to keep the workflows simple. If you have several custom workflow activities, for instance, activities for integrating with other systems, I would be very careful since it is hard, if not impossible to restrict a custom workflow activity to just a selected amount of users.

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Monday, June 01, 2009

Internet Facing Deployment

As many of you know, one of the integral and unique parts of Dynamics CRM 4.0 is it's ability to be Internet facing. This does not only mean that you have to choose between the ameneties of a normal AD logon and the grace of IFD, you can have both. So, even if you are just a small company with just a small business version of CRM 4.0 and not a larger corporation, there is no reason why you shouldn't use Dynamics CRM 4.0 with the IFD technology.

So, how do you do it?

There are some good documents provided by Microsoft on how to do it(like this one: but there are some parts of it that are a bit tricky and depend on some of the infrastructure components you have, like DNS, and that might not be Microsoft, or even hosted. So I thought I'd describe a bit about how it works and give an example of how to do it.

First of all you have to do a normal installation of CRM 4.0. You can install on port 5555, 80 or any other TCP port. It doesn't matter for IFD deployment, however, port 80 or 443 have to be made available from the Internet so the physical placement of the CRM server is critical. You can use normal redirect techniques or reverse proxy lookup (as in ISA-server). The important fact is that the server must be placed so that it can be reached from the outside.

The next thing you have to set up is an external name that you can use when adressing the server from Internet, hence it has to be a real name and not just an internal name. If you have registered a domainname you could set a hostname to point to the organizations you want to access.

I used and registered a name like "mydomain" and my CRM organization was mycrm, when using IFD that would make the address for this org:

Make sure that everything bellow also gets redirected to you CRM servers external URL (port 80 or 443 depending on if you are using SSL or not)

The next step is to run the IFD Tool as referenced in the Microsoft Document. It can be downloaded from here.

Use it to set up CRM by setting the right stuff in the web.config and setting some keys in the registry. It is a lot easier than doing it yourself. You have to set it up to the external name you have chosen.

Now the final step is to add a host header in the IIS website for CRM for * or explicitly for for port 80 or 443 depending on your setup.

Now you should be able to browse to and get to the logon screen.

To get reports working you have to install the report connector software found on the CRM CD/DVD.

There are of course lot of variations to this, using reverse proxy of ISA Server and all the options of setting up certificates for SSL but I'll leave that out of this posting to keep it simple.

Menno has recently published a posting on this as well (, and there are several other blogs and MS KB articles concerning this. If you have problems, try taking it a step at a time and analyse and design the setup first so that you have got it figgured before you start configuring!

Good luck!

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Friday, May 08, 2009

Enhancing performance in virtual machines

I follow the blog Microsoft Dynamics CRM UK Blog which is very good and they had an interesting posting today concerning performance issues in virtual PC 2007 on laptops. As most consultants, I use one (a lenovo T61p). You can read more about it here:

When I tried to apply the change to the file they mentioned (%appdata%\Microsoft\Virtual PC\options.xml) I had a problem since I didn't have the parent tag in my file. I checked around a bit and found that it could just be added to the main structure. So, after modifications, my file looked like this:

<enable_idle_thread type="boolean">true</enable_idle_thread>

I would recommend adding it, if you most of the time have the computer connected to the power outlet, since it will probably increase the performance of your virtual machines!

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Monday, April 20, 2009

Importing large customization files to vanilla system

Sometimes you will need to import large customization files from one system to a vanilla system (no customizations). This file will often include workflows as well as new entities and attributes.

Since the workflows are dependant on the entities of the CRM system, a workflow cannot be imported if the entities it depends on do not exist.

This is usually not a problem in English based systems since Workflow starts with the letter "W" and hence is quite far down the list. In Swedish it is named "Arbetsflöde" and hence will be placed at the top. So, when importing the customization file, if importing everything, the system might give you an error if any workflow is dependant on an entitiy with a displayname after "A".

The solution is simple, just import everything but workflows first and then import workflows.

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Monday, February 23, 2009

Errors when programmatically attaching events in forms

Today I had a very weird error. I had two datetime fields on a form, one on the first tab and one one the second. Let's call them date1 and date2 to make it easier.

I attached an event in the onload by using

crmForm.all.date1.attachEvent("onchange", myFunc1);

and for the date2 field:

crmForm.all.date2.attachEvent("onchange", myFunc2);

The weird part was that if I changed date1 first and then date2, myFunc2 didn't fire. But if I first changed date2 and then date1, both fired as they should.

So I tried just adding an alert instead using the normal onchange method via the form editor in CRM and that triggered every time, just as it should, so something is different.

The simple solution seemed to be to move date2 from the second tab to the first. That got everything working just as it should.

I havn't tried it but I think that one could also write a method that confirms all the event attachments and then calling this at the end of every onchange triggering function and perhaps some extra time when the tabs are changed to make sure the events are bound correctly.

I have checked the documentation in CRM for if this kind of runtime event attachment might not be supported but my interpretation of the text is that is should be all right according to it. The closest paragraph in the unsupported customization section is the following:

"The use of custom HttpModules to inject HTML/DHTML into the Microsoft Dynamics CRM Forms. "

As I wrote, my interpretation is that attaching events (not even overwriting the onchange), should be ok according to this since we arn't injecting anything, just adding an event listener. Hence I feel that this must be interpreted as a bugg in CRM.

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Tuesday, February 17, 2009

Unicode conversion

When writing javascripts with alerts or similar when not working with english, special characters like the swedish åäö might not be shown correctly. I found this helpful page where you can enter the string you want to convert and then copy paste the result. Simple and nice.

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Really cool way of getting FetchXML from advanced find

I've been having some problems with my blogs in Outlook but today I fixed it and started checked if there was anything special and found this very interesting article on Ronald Lemmens blog.

He describes how to, without any code or customizations to a system, easily get the fetchxml code from an advanced find by just putting some javascriptcode in the url of the window. Beautiful in all it simplicity!

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Force update of Report

The project I am currently involved in uses Reporting Services reports that are shown as PDF:s as quotes that are sent to the customer. It is implemented by creating a custom report that takes the object id (like quote) which is called from an isv.config button and by using querystring parameters, the output is directed to PDF.

However, I got a puzzeling bug. The data in the quote is of course based on data in some CRM entities and when a quote was generated and the user found something was wrong, changed this in CRM, saved and then tried to regenerate the PDF, the change didn't show. I restared Internet Explorer, and regenerated the quote-pdf and now it showed correctly. Hence some sort of caching error.

I looked around the internet a bit and found that by adding the following parameter to the querystring, I could refresh the sessions variables and I would get a fresh and correct report.´


So, the entire url was (except for the report id etc.):


So, if you get a similar error, just try setting this.

It is also possible that IE caches the pdf and then you'll have to add some variable to the querystring, like a tick or datetime that is unique for every call (from that client) and that will bypass IE:s caching.

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Tuesday, February 03, 2009

Workflow warning

Today I was troubleshooting a CRM server which had the CRMAsycnService and w3wp service totally hogging the machine. It was quite obvious that it was CRM that was the cause for this and since CRMAsyncService was involved, probably workflows or perhaps the deletionservice.

After a bit of looking around I found a workflow that was set to trigger on attribute change on an entity and then later in that same entity, changed some attributes. This caused an infinite loop which was the cause for the hogging. By first unpublishing the workflow and then removing all started systemjobs, I got the machine back up to speed.

My conclusion from this is that even though the workflow GUI seems easy it is deceitfully powerfull and you quite easily create workflows that hogg the server (the server hosting the async-service anyway). This should be taken into consideration when putting this tool into the hands of non-programmers since the risk for the entire system stability is large. This can be either application consultants or power users at the customer.

There is also no standard way of locking some of the triggers on workflows so that you can eliminate this risk. I you know of any, please leave a comment!

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Monday, February 02, 2009

Process implementation strategy

When implementing a business process in Dynamics CRM there are several different implementation paths to choose from. There are advantages and disadvantages to the different techniques but there are some goals that I feel the implementations should meet, mainly:

1. Fully supported customizations only

2. Flexible and non-static.

3. Power user modifiable

4. Movable from environment to environment (dev-test-production)

I will discuss the different aspects bellow and why I feel they are important.

Fully supported customizations only

This is almost so self-evident that it doesn't even need mentioning but I have seen several CRM implementations that not only nudge this paradigm in the corner, but bite big large chunks out of it. For me, the number one reason why this is so important is that all customers will sooner or later want a hotfix or upgrade to a later version and when Microsoft, in their greatest foresight and benevolence definied the concept of supported customizations, they made this possible without costly maintanance agreements or hostile customer relationships. So, not following it should be punishable by death or something close to it.

I would presume that you CRM implementations are meant to last for your customers and that you want a long a fruitfull relationship with your customer, why you just cannot underestimate this point. If you have to make unsupported customizations, make sure they are as light weight as possible, document them thouroghly and how to validate them when installing a hotfix or upgrade.

A business process must hence be made as supported as possible.

Flexible and non-static

The solution has to be flexible and non-static. We, and our customers live in an ever changing world and to cope with this, business processes have to change as the world around a company changes. Just imagine the changes the telecom industry has gone through the latest 20 years. To fully accomodate this the customer implementations have to be flexible and changable. Microsoft Dynamics CRM is one of the most versatile and flexible systems available, especially now that it incorporates windows workflow foundation. Implementing a business process in code entirly, locks the processes down, and builds a dependance on the CRM delivering partner, something every customer-value focused consultant must despise. I do not need to force my customers to use my services when I can get them to choose me because of the value I deliver to them every hour of every day.

Instead, use the power of Windows Workflow Foundation combined with custom workflow activities. If needed, trigger these workflows using plug-ins and isv.config customizations.

Power user modifiable

A business process often involves users of different sorts and communicates with these using emails, tasks and other activites. The content of these and the recipients, sometimes dynamically set, sometimes static (like the CFO), might need to be changed. Therefore it is not very flexible for the customer if code has to be re-written everytime a mail has to be changed. It is a lot more flexible to create a workflow that creates the activity and then just execute the workflow from code, apart from the fact that it is a lot quicker to implement. Just write a method that enables you to execute the workflow by name instead of Guid.

Movable from environment to environment (dev-test-production)

All implementations of any notable size always includes at least three environements, not seldom up to 5 or 6 depending on how you count (local dev, central dev, test, training, production). Business process implementations have to be easy to move between solutions without any or with as little as possible environement specifics. Hence, try to use names (or some other environment indpendant value) instead of guids since guids are environment specifics when relating to workflows and other similar things. Try to get all environement specific settings in one place, one file or create an entity for them. This can be a challange but try, it will pay off in the long run.

These are my thoughts on the business processes implementation stategy concerning Dynamics CRM 4. I would be happy to discuss the topic so please leave comments!

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Thursday, January 29, 2009

Problem opening workflows in CRM GUI

Currently I am working on a project with a quite complex sales process and part of it is managed by workflows (for flexibility) and to be able to do what is needed, I have developed several custom workflow activities.

However, today I had just installed some stuff and was going to review one of the workflows, and the CRM GUI crashed with the Exception "System.NullReferenceException" in a really nasty way when I tried to open it. By looking at the stack trace I got a feeling it had something to do with my custom activities so I just reregistered them and then everything started working again. So if you come across this error, this might be the problem. I couldn't find any reference to this error on the net why I thought it might be a good idea to blog about it.

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Wednesday, January 28, 2009

Workflow activity development and file locking

As some of you might have noticed, the dll:s containing the custom workflow activities might get locked and hence the compilation fails in it's final stage.

To handle this, I tried a good program called Unlocker 1.8.7 which you can find here: - it is freeware and it will tell you which processes are locking a file and can help you kill them.

So, what is locking my dll? Well, actually several processes are involved both the MSCRMAsyncService and the IIS worker process (w3wp).

The most obvious way of handling it is just restarting the two services and that will work. However, restarting the w3wp process will require the entire CRM application to be recompiled which will create extra long and annoying waits. Instead, just recycle the applicationpool involved (CRMAppPool).

There are no problems restarting the MSCRMAsyncService.

And if you want to do it all in the pre-build event just add the following lines:

net stop "MSCRMAsyncService"
net start "MSCRMAsyncService"
cscript C:\Inetpub\AdminScripts\adsutil.vbs stop_server W3svc/AppPools/CRMAppPool cscript C:\Inetpub\AdminScripts\adsutil.vbs start_server W3svc/AppPools/CRMAppPool

And if you are still having problems, use the unlocker program!

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Tuesday, January 13, 2009

List Web Part for Dynamics CRM 4.0

Finally Microsoft have release the List Web Part for Dynamics CRM 4.0. I havn't had the opportunity to test it yet but the previous version (for CRM 3) had problems with non-english versions of SharePoint so be aware, especially if you are running CRM and SharePoint in different base languages.

If you have any experience of it, please let me know.

Gustaf Westerlund
Microsoft Dynamics CRM Architect