Wednesday, May 30, 2007

Showing related forms

One thing I appreciate about good blogs is the viral spreading of interesting stuff, so that good solutions arn't just available in some corner of the world, but can be used all over. I believe this is one of the real assets of working with the great products MS CRM and MS SharePoint.

I try to keep track of quite a few different blogs and when I find something interesting I (as you have seen before) usually add a posting linking to this blog. This way, I hope you will find my blog even more usefull since you shouldn't really need to keep track of all blogs yourself. (if your interests match mine, that is of course)

On one of the blogs I subscribe to, I found an interesting post concerning how to add related forms into existing forms in MS CRM. This can be very usefull when customers demand GUI modification. So, please have a look:

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB

Kerberos / Trust Delegation

As some of you might have experienced the easiest way to deploy MS CRM 3 is to have SQL Server and SQL RS on the same machine, this will let you duck from a lot of problems, so if you don't know better and have no reason not to, choose this setup.

However, this is not always what is best. The most common scenario when this is not the case is when a company has a large SQL Cluster (or just a dedicated SQL Server) and for several reasons (mainly licensing and maintance) want to have the CRM database and CRM reports on the central SQL server. Now, I am not an expert at this, but I have tried to dive in to it a bit and I have found the following:

If you are running the application pool of CRM, application pool of SQL RS and the main SQL server as Network Service, you will usually be fine, it will probably work more or less out of the box.

However, if not, you will get a warning in the installation of CRM saying something like "SPN not set correctly" for SQL RS. You can, if you like, install CRM anyway, but reports will only work when running them directly using Report Manager/Report Server or when running IE from the CRM server. Since it is not best practice to have the CRM server double as a terminal server, this is not often very nice.

So, what's wrong? The problem lies in that all requests from SQL RS to the SQL database, are done using the technique "impersonation" which means that all requests in the database are run as the "current user"/the user that is running IE. This is a very good feature since it among other things enables the Filtered Views in the SQL database the only returns the items that the current user has access to. The problem is that CRM is acting HTTP proxy for the SQL RS and as such cannot send the current users credentials to the Report Server.

What needs to be done? Well, the CRM server user must be set up to enable trust delegation (i.e. forwarding of credentials) and the service users running the CRM apppool, SQL RS app pool and SQL must have the correct SPN:s set for them.

There are several documents and blogs describing how this can be set up, Sonoma Partner has one and the document with the short title: Additional Tasks When Microsoft SQL Reporting Services is installed on a separate server from Microsoft CRM or Microsoft SQL Server by Microsoft is also a good help.

The biggest problem usually is that you will have to run the "setspn" tool on the service account that is running the SQL Cluster/dedicated SQL machine and even though that shouldn't cause any problems, if it does, and you are running x number of business critical applications on the SQL server, you might be in for a long night...

My suggestion is that you first try to set this up in a demo environment and when you got it working, then redo it on the live environment on a late friday afternoon, and make sure you havn't got anything planned for the weekend...

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB

Avoiding IIS Reset

Both in SharePoint development and CRM development, IISReset is needed sometimes to release fileholds. For instance, when developing callouts in MS CRM, the callout.config file will be blocked (by w3wp-crmapppool) as soon as a callout has been run.

The biggest problem with IISReset (or shuting the IIS down, compiling, restarting it) is that the entire application will be "just-in-time-compiled" each time, taking huge amounts of time especially when developing on virtual pc:s with only 1 GB (or less) of memory.

The workaround for this is to recycle the application pool for the IIS-website instead of restarting the entire IIS.

The easiest way of doing this is to right-click on the applicationpool and the choose "recycle".

This can be scripted (as described on Patrick Tissegheims blog) by using the script:

cscript c:\windows\system32\iisapp.vbs /a "SharePointDefaultAppPool" /r

Or as Patrick also mentions, there is a good tool for doing this, that can be found here:

So, that might easy your troubles, and save you some time.

If you are compiling on the server, my suggestion is to add the script to the pre build events in the project.

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB

Tuesday, May 29, 2007

Untrack email in Outlook (V3C)

It is easy to track emails in Outlook which adds them to CRM. However, if an email linked to the wrong object, it is not as easy to "untrack" an email. Sonoma Partner blog describes how to do it, have a look:

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB

How to mass import lots of mails

This blog posting shows how to add lots of emails to CRM that do not have a tracking token.

One issue with this solution is that many emails should still be added to specific accounts, orders, incidents etc. There is no simple solution but I would use the advanced search and bulk edit function to set the "regarding" field of all emails.

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB

Monday, May 28, 2007

Net stop / Net start

Developing lots of workflow dll:s? Add the following text to the prebuild events (if you are developing on the server):
net stop "Microsoft CRM Workflow Service"

and then
net start "Microsoft CRM Workflow Service"

which will save you the time of turning the Workflow-service off and on manually with each compilation.

If it is a live server, make sure you understand the complications!

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB

Creating CRM-emails in C# code

I have in a previuos post described how to programmatically download a SQL RS report, create a CRM email and attach the report as a pdf to it and send it. This is quite many steps and sometimes it will just be good enough to send mails, for instance when developing addons for workflows.

email em = new email();

activityparty fromparty = new activityparty();
fromparty.partyid = new Lookup();
fromparty.partyid.type = EntityName.systemuser.ToString(); //Change to some other entity if needed.
fromparty.partyid.Value = FROM-SYSTEMUSER-GUID;
em.from = new activityparty[] { fromparty };

activityparty toparty = new activityparty();
toparty.partyid = new Lookup();
toparty.partyid.type =; //Change to some other entity if needed

toparty.partyid.Value = TO-CONTACT-GUID; = new activityparty[] { toparty };

em.subject = SUBJECT-STRING;
em.sender = "";

em.regardingobjectid = new Lookup();
em.regardingobjectid.type = EntityName.REGARDING ENTITY TYPE.ToString();
em.regardingobjectid.Value = REGARDING OBJECT GUID;
em.description = BODY-STRING;

em.ownerid = new Owner();
em.ownerid.type = EntityName.systemuser.ToString();
em.ownerid.Value = OWNER-SYSTEMUSER-GUID;
Guid createdEmailGuid = service.Create(em);

SendEmailRequest req = new SendEmailRequest();
req.EmailId = createdEmailGuid;
req.TrackingToken = "";
req.IssueSend = true;

// Send the email message.
SendEmailResponse res = (SendEmailResponse)service.Execute(req);

I find this code very helpfull. It can probably be generalized by using BusinessEntity object and so forth but I am usually quite satisfied with this.

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB

Thursday, May 24, 2007

Getting lots of copies of your mails

The new feature of email enabled document libraries in SharePoint 3 is great, but I recently experienced problems with getting a new copy of the mail every five/ten minutes. After a bit of error searching, I found that it was due to the fact that SharePoint didn't have delete access rights to the "drop" folder in the c:\inetpub\mailroot directory, hence after sharepoint has read the mail, it can't delete it. The next time sharepoint polls the directory, it will find the same mail and add it again, and again, and again... so just make sure the access rights are right.

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB

Tuesday, May 22, 2007

Blogging and being a consultant

Some of you who read this blog are probably consultants and find it strange (or stupid) that I should share my knowledge with you and others on this blog and in the forums that I attend (mostly the swedish forum Some other find it strange that I wont give answers to certain questions, so I thought I might clear things up a bit by describing my thoughts on what to blog on and what not.

In general, I will blog on topics that are non-customer specific, meaning that I will discuss common problems, design patterns, installation issues, tips and tricks. I might also discuss a specific solution in the aspect that it might be of interest for other implementors as inspiration. However, specific customer problems that are very unlikely to happen in other environments, customer specific analysis and designs are what I do for a living. I will not blog on these topics, in more than a general sense.

So, I will be more than happy to share my thoughts on common issues and if you want my opinion on any of those, please comment my blog or send me an email at gustaf (a)

I apply the same rules for postings in forums meaning that I will not answer questions like:
"We are a company that has 50 emplyees with 10 inside sales and 4 outside sales. How should we configure CRM?". This question can only be answered by doing a deeper analysis of how the companys sales processes (and other processes) work, and the answer is a CRM design. The same question but focused on which license or what hardware would be needed, is more of a general question and this I could discuss.

Of course there will always be gray areas and I will leave this to my judgement and I hope you will respect this.

As for commenting, your chances are a lot greater if your comments are not anonymous. I also like to quote my grandfather who used to say: "It is better to drive a strong point than strong language (freely translated from Swedish)" meaning that harsh language will get you nowhere.

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB

Monday, May 21, 2007

Where to place your custom aspx files

Today I held another crash-course in Extending MS CRM 3 with .NET. It is a very comressed version of the MOC (Microsoft Official Curriculum) course with the same name. The attendées were 4 very sharp CRM professionals from Cybernetics and Releye. If you are interested in attending this course please contact Informator at

We were discussing the problems with kerberos double-hopp trust delegation when using a SQL RS on a different server than the CRM server. It dawned on my however that a similar problem might acctually arise if you choose to host your custom aspx-files on a separate server from the CRM-server. I am no expert at this kerberos stuff but would find it quite possible that you might get this problem. I havn't tested this, so treat it as a hunch. If anyone has confirmation or the opposite, please comment this posting.

In short, to avoid potential problems, make sure your website for you custom websites are hosted on the same server as CRM. (please note that it is not supported to use the same website as CRM).

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB

Monday, May 14, 2007

Excel Services as report system for CRM

Today I held a presentation at this years SharePoint and Exchange Forum in Nynäshamn, close to Stockholm, here in Sweden. Lots of very interesting experts here like Patrick Tisseghem, Michael Noel and Nick Swan, not forgetting my boss, Göran Husman and other great speakers from Microsoft and other companies.

The presentation I held was BDM-focused and concerned the power of simple mesh-up integration between SharePoint and MS CRM 3. The main point being that SharePoint has a lot of great features that can be used by other applications.

One of the most powerful ones is excel services that can very powerfully be used as a reports tool for MS CRM. The main advantages being the ease of use for the end users and report owners since they easily can modify their own reports with Excel.

It is almost too simple to write a blog about it, since it is very straight forward, but I will see if I can get something together anyway.

By the way, I am expecting to be a father around the 1:st of june (my first child!) and I migth be a bit absent for a week or two after this event, but I will be back.

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB

Updated CRM List WebPart

The CRM Team blog has announced that MS now have released the next version of CRM List WebPart.

I have tried it on a system with English CRM and SharePoint and it works great!

However, I tried the previous version on a Swedish version of CRM and SharePoint and that did not work as well, especially the installation. I was able to install it manually after quite a lot of work. If this version has the same problems I cannot say.

Gustaf Westerlund
CRM and SharePoint Consultant

Humandata AB