Get rid of "Do you want to close this window?"

You might get a question when opening CRM in Internet Explorer. The question is:


The webpage you are viewing is trying to close the window.
Do you want to close this window?
yes no

This message does appear in CRM 4.0 only when you are using Internet Explorer 7.0 and you have enabled the application mode setting. Nevertheless, it is an anoying message which you can get away!

To get rid of this message open the default.aspx file which resides in the root of the CRM website. In this file there are these three lines of code:

var oMe = window.self;
oMe.opener = window.self;
oMe.close();

Modify the second line of this snippet and end up with these three lines:

var oMe = window.self;
oMe.open('','_self','');
oMe.close();

You now will not have the message anymore. Keep in mind that any update or migration might remove this change, but you should be able to reapply the change easily again.



Overview of CRM 4.0 Training & development collateral

Microsoft employee Jon Butler is sending me updates on CRM regularly. This time he has sent an overview of the available training material. Since this is such a usefull list, I thought it would be worth sharing this with you guys!

Official Courseware available now
These training courses are the Microsoft Dynamics Official Curriculum currently available for CRM 4.0 now, either as soft-copy downloads, ordered hard copy – or you can schedule classroom training.

Download them directly via https://mbs.microsoft.com/partnersource/communities/training/trainingmaterials/student or https://mbs.microsoft.com/customersource/training/trainingmaterials/student/ for customer source access.

Extending Microsoft Dynamics CRM 4.0 - Course Number 8969
This three-day training material provides individuals with the knowledge and skills to develop extensions for Microsoft Dynamics CRM. The training material focuses on extension methods documented in the Microsoft Dynamics CRM SDK.It also includes content on Microsoft Dynamics CRM Web Service programming, creating and configuring Custom Workflow Activities and Plug-ins, advanced client-side scripting, application integration capabilities and how to create a customer portal solution that connects Microsoft Dynamics CRM to the Internet.

Administration in Microsoft Dynamics CRM 4.0 - Course Number 80002
This training material, Administration in Microsoft Dynamics CRM 4.0, provides individuals with the necessary techniques to plan, develop, apply, and examine administrative tasks within Microsoft Dynamics CRM 4.0.

Workflow in Microsoft Dynamics CRM 4.0 - Course Number 80003
This training material describes how to create, run, and monitor workflows to automate business processes. The training material emphasizes out-of-box workflow functionality. The training material includes the following topics:Basic concepts Creating a basic workflow Design process Update triggers Conditional branching Advanced workflows Multi-stage workflows Monitoring workflows Workflow securityThe training material also focuses on using workflows in Microsoft Dynamics CRM 4.0 to automate the following business processes:Sales process Lead promotion Probable revenueThe following topics are not covered in detail in this training material, but are introduced to provide individuals with insight into potential advanced workflow topics:Extending workflows with custom assemblies Upgrading workflows Data migration and workflows

Customization and Configuration in Microsoft Dynamics CRM 4.0 - Course Number 8912
This three-day training material provides individuals with the tools to configure and customize Microsoft Dynamics CRM 4.0. Configuration topics include setting up business management functions such as:Business units Users Teams Security privileges and roles System Settings Multilingual User Interface Language Packs Currency Exchange Rates Multiple OrganizationsThe training material also focuses on using the Microsoft Dynamics CRM 4.0 Customization tools to customize the following system components:Forms Views Entities Attributes Relationships Entity MappingsThe following customization topics are outside the scope of this training material, but are introduced here to provide individuals with insight into potential advanced customization features:Application Event Programming Client Extensions Workflow SiteMap URL Addressable Forms IFrames SDK

Applications in Microsoft Dynamics CRM 4.0 - Course Number 8913
This three-day training material explores the Microsoft Dynamics CRM application from a user's perspective. Application functionality covered in the training material includes: Sales Management Marketing Automation Service Management Service Scheduling

What’s New in Microsoft Dynamics CRM 4.0 - Course Number 8910
This one-day training material provides individuals with the knowledge and skills to begin planning for Microsoft Dynamics CRM 4.0.

Installation and Deployment in Microsoft Dynamics CRM 4.0 - Course Number 8911
This three-day training material provides individuals with the tools to install and configure Microsoft Dynamics CRM 4.0. The training material focuses on the components used within a Microsoft Dynamics CRM deployment, the hardware and software requirements needed to successfully deploy Microsoft Dynamics CRM, and the installation instructions for the primary Microsoft Dynamics CRM components: the Microsoft Dynamics CRM Server, the E-Mail Router, and Microsoft Dynamics CRM for Office Outlook.

E-Learning available now
Note that for an individual to view the E-Learning online, they’ll have to be set up as a user in PartnerSource/CustomerSource. Some partners or customers prefer to download the E-Learning courses for their trainees instead, and have the trainees view them offline

This query will bring up all E-Learning courses (57 is the current count) – but note that they map pretty consistently to individual chapters of the Official Courseware, so the content of the Official Courseware and E-Learning are similar:
http://dynamics.microsoftelearning.com/catalog/default.aspx?view=catalog&filterView=basic&productFilter=Microsoft%20Dynamics%20CRM%204.0&productFilterDisabledValue=&seriesFilter=def-0&seriesFilterDisabledValue=&collectionFilter=def-0&collectionFilterDisabledValue=&searchAction=filter&sortColumnId=&sortOrderAscDsc=&pageNumber=

You can filter this further to essentially get E-Learning versions of the Official Courseware training courses listed above. The right column lists appropriate audiences, such as Desktop and End-User Support Professionals, Developers, IT Professional

Dynamics CRM 4.0 collateral from the Microsoft Download Center
All available via http://www.microsoft.com/downloads/results.aspx?freetext=&productID=835909D0-A755-41FF-93CD-F5207C609EF5&DisplayLang=en
A minor subset of the 155 items available via the Download Center URL provided above

Microsoft Dynamics CRM 4.0 Implementation Guide
This guide contains comprehensive information about how to plan, install, and maintain Microsoft Dynamics CRM 4.0.

Microsoft Dynamics CRM 4.0 SDK
This package contains the complete software development kit for Microsoft Dynamics CRM 4.0.

Microsoft Dynamics CRM 4.0 Logical Database Diagrams
A series of diagrams showing the logical database structure for Microsoft CRM 4.0.

Microsoft Dynamics CRM 4.0 Internet Facing Deployment Scenarios
This document covers how to set up the Microsoft Dynamics CRM 4.0 Web site to make it available from the Internet.

Microsoft Dynamics CRM 4.0 ISV White Paper
How to create business applications for Microsoft Dynamics CRM 4.0.

Microsoft Dynamics CRM 4.0 Data Migration Manager
Using the Microsoft Dynamics CRM 4.0 Data Migration Manager, you can convert and upload data from another CRM system to Microsoft Dynamics CRM 4.0.

Optimizing and Maintaining Microsoft Dynamics CRM 4.0
This white paper details techniques, considerations, and best practices for optimizing and maintaining the performance of Microsoft Dynamics CRM 4.0 implementations.

Offline and Online Synchronization in Microsoft Dynamics CRM
This "nuts and bolts" white paper details the Offline and Online synchronization processes in Microsoft Dynamics CRM 4.0.

How to configure the Microsoft Dynamics CRM 4.0 On-premise and Online E-mail Router in different deployment scenarios
This document lists steps to configure Microsoft Dynamics CRM 4.0 e-mail in different deployment scenarios.

Microsoft Dynamics CRM 4.0 Performance and Scalability
Microsoft, together with Unisys Corporation, completed benchmark testing of Microsoft Dynamics CRM 4.0 running on Microsoft® Windows Server® 2008 operating system and Microsoft SQL Server® 2008 database software. Benchmark results demonstrate that Microsoft Dynamics CRM can scale to meet the needs of an enterprise.

Microsoft Dynamics CRM 4.0 Deployment SDK
SDK for customizing deployments for Microsoft Dynamics CRM 4.0.

Microsoft Dynamics CRM 4.0 Suggested Hardware for Deployments of up to 500 Concurrent Users
Describes general hardware sizing information that will support Microsoft Dynamics CRM version 4.0 with up to 500 concurrent users in a single deployment on-premise model.

SEE ALSO:
Microsoft Dynamics CRM Developer Center
Access to SDK-related information, including access to CRM developers, etc.

Microsoft CRM Blog
Very useful, target, in-depth knowledge shared by program managers, developers, and testers from the CRM Product Group as well as other sources


Hope this is useful.



Get the latest hotfixes for the CRM 4.0 outlook client

The product team has posted a blog article about the known issues with their hotfixes on the team blog. I'd strongly recommend everybody to look at this list and to install all applicable hotfixes for your system.

The following issues are discussed:
1. Outlook hangs during initialization (progress toolbar displays “Loading…” and never finishes)
2. With E-mail Auto Promotion Enabled, Outlook may not close cleanly/properly.
3. Contacts with birthdays earlier than 1/1/1970 causes Outlook to crash
4. Items in Shared Calendars will report Sync Issues
5. Cannot Promote an E-mail where the name of the attached file contains a ‘&’ symbol.
6. Selecting Dismiss on Outlook Calendar reminder for Service Activity causes record to change Status Reason back to default value for that record.
7. OWA Sent Emails Get Stuck in Outlook Draft Folder When Outlook Is Open And CRMADDIN is Enabled
8. Microsoft Outlook stops responding when you open, close, reply to, or forward e-mail messages in the Microsoft Dynamics CRM 4.0 client for Outlook
9. CRM Outlook client and/or Desktop Client hangs in presence of other Outlook add-ins
10. Phone call activity due time is changed after the activity is snoozed or dismissed.

There is a cumulative hotfix which does fix each of these as well: Download



Custom entities and attributes in a plug-in

You cannot create a webservice in Visual Studio when you're writing a plugin. Instead you need to use the method context.CreateCrmService(true);. There is only one single issue when using this approach. You cannot leverage the power of IntelliSense in Visual Studio. Visual Studio will not recognize your custom entities and attributes. How to work with this? The only correct answer is "Dynamic Entities".

To retrieve records based on some attribute values you could use a piece of code like this:


// Create the QueryByAttribute object.
QueryByAttribute query = new QueryByAttribute();
query.ColumnSet = new AllColumns();
query.EntityName = "new_customentity";
query.Attributes = new string[] { "new_customentityid" };
query.Values = new string[] { customEntityId };

// Create the request.
RetrieveMultipleRequest request = new RetrieveMultipleRequest();

// Set the request properties.
request.Query = query;
request.ReturnDynamicEntities = true;

// Execute the request.
RetrieveMultipleResponse response = (RetrieveMultipleResponse)service.Execute(request);

One of the most important details in this piece of code is this line:

request.ReturnDynamicEntities = true;

If you forget this line, you'll end up with this error message:

System.InvalidOperationException was unhandled by user code Message="There is an error in XML document (1, 509)." Source="System.Xml" StackTrace: at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at Microsoft.Crm.SdkTypeProxy.CrmService.Execute(Request Request) at Microsoft.Crm.Asynchronous.SdkTypeProxyCrmServiceWrapper.Execute(Object request) at ...your assembly information...

So, don't forget the ReturnDynamicEntities attribute and you should be fine to go!



Unauthorized error after deploying your custom application

I've been working on deploying an application today. I received the error "Unauthorized" all the time and did not know why. The website was deployed as a new virtual directory within the ISV folder, authentication was set to integrated windows authentication and the password which was supplied was correct. Still I was able to get this error message:


Server Error in '/ISV/CustomApplication' Application.
The request failed with HTTP status 401: Unauthorized. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.WebException: The request failed with HTTP status 401: Unauthorized.Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
[WebException: The request failed with HTTP status 401: Unauthorized.]
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +551137
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +204
Microsoft.Crm.Metadata.MetadataWebService.GetDataSet() +31
Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadDataSetFromWebService(Guid orgId) +301
Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadCacheFromWebService(LoadMasks masks, Guid organizationId) +40
Microsoft.Crm.Metadata.DynamicMetadataCacheFactory.LoadMetadataCache(LoadMethod method, CacheType type, IOrganizationContext context) +418
Microsoft.Crm.Metadata.MetadataCache.LoadCache(IOrganizationContext context) +324
Microsoft.Crm.Metadata.MetadataCache.GetInstance(IOrganizationContext context) +386
Microsoft.Crm.BusinessEntities.BusinessEntityMoniker..ctor(Guid id, String entityName, Guid organizationId) +115
Microsoft.Crm.Caching.UserDataCacheLoader.LoadCacheData(Guid key, ExecutionContext context) +323
Microsoft.Crm.Caching.ObjectModelCacheLoader`2.LoadCacheData(TKey key, IOrganizationContext context) +389
Microsoft.Crm.Caching.BasicCrmCache`2.CreateEntry(TKey key, IOrganizationContext context) +82
Microsoft.Crm.Caching.BasicCrmCache`2.LookupEntry(TKey key, IOrganizationContext context) +108
Microsoft.Crm.BusinessEntities.SecurityLibrary.GetUserInfoInternal(WindowsIdentity identity, IOrganizationContext context, UserAuth& userInfo) +344
Microsoft.Crm.BusinessEntities.SecurityLibrary.GetCallerAndBusinessGuidsFromThread(WindowsIdentity identity, Guid organizationId) +194
Microsoft.Crm.Authentication.CrmWindowsIdentity..ctor(WindowsIdentity innerIdentity, Boolean publishCrmUser, Guid organizationId) +279
Microsoft.Crm.Authentication.WindowsAuthenticationProvider.Authenticate(HttpApplication application) +605
Microsoft.Crm.Authentication.AuthenticationStep.Authenticate(HttpApplication application) +125
Microsoft.Crm.Authentication.AuthenticationPipeline.Authenticate(HttpApplication application) +66
Microsoft.Crm.Authentication.AuthenticationEngine.Execute(Object sender, EventArgs e) +513
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

After quite a search I managed to find this blog. There I learned that CRM is using an HttpModule for multitenancy. The http module will be called with an anonymous user account and will fail when it's requesting the metadata webservice. To make your own app working, you'll need to remove the HttpModule from being loaded. A copy paste piece from Cesar de la Torre's blog:

This is what you have to add to your own web.con file:

<system.web>
<httpModules>
<clear/>
</httpModules>

Also, if you are not using any CRM 4.0 Titan assembly within your app, you can also get rid of all the references, adding also the following:

<assemblies>
<clear/>
<add assembly="*"/>


Personally I prefer the removal of only the exact names instead of a generic "clear". What I ended up using is:

<httpModules>
<remove name ="CrmAuthentication"/>
<remove name ="MapOrg"/>
</httpModules>


If any of you finds a better approach I'm glad to hear that. Until then I'll be using this approach.



Convert lead to contact, account and/or opportunity programmatically

Update: The codeproject missed a line of code. After you have executed the InitializeFromRequest, then you'll get a InitializeFromResponse. This response has got a entity in it. This entity you will need to create. The entity does not yet get created by executing the InitializeFromRequest! The line to add is:


Guid entityId = service.Create(rps.Entity);

Today I needed some code which does convert a lead to a contact programmatically. Instead of just building, I first asked my mate Google if he knew how to do that. Kind as Google is, he told me that he didn't know, but he knew that Cem Onvar knows that. Cem has published the code on the codeproject website.

Basically it comes down to two steps. The first step is to disable the lead. This can be done by using the SetStateLeadRequest. The second step is to use an request class which is quite rare. It's the InitializeFromRequest class. On this class you can set the EntityMoniker attribute to the lead which you just disabled. On the same request you'll need to set the target entityname to the name of the entity you wish to convert the lead into (contact, account or opportunity) and you'll need to set the TargetFieldType. This would most likely be TargetFieldType.All. Now execute that request and you're done.

For the direct code look at the codeproject site.

Keep in mind that you can use this approach for all kind of conversions.



Plug-in not working

One of the most read pages on my blog is the list of reasons why a callout won't work. Since the release of CRM 4.0 we do not have callouts anymore, but we're using plug-ins for extending CRM. This article will contain all the reasons that I find on why a plug-in is not working.

Error:


"Unable to load the plug-in assembly"

There are multiple reasons why this error can occur. These reasons include:

- The plug-in is registered on disk, but the file is not located in the correct location (drive:\crm server folder\server\bin\assembly\). Keep in mind that if you use the registration tool that the plug-in will be registered, but the file will not be placed in the right location. This is a manual step.

- The plug-in is registered on disk and the file is located in the correct location, but the security settings are not correctly set on the assembly file. Once you have copied the file to the \server\bin\assembly folder, make sure that you check the permissions of the file. The user which is used to run the application pool in which CRM is running, should have read & execute rights. You can set this by going to the folder and right click on your plugin its dll file. Then press "Properties". Go to the tab "Security" and add the user which is used for the application pool. This user you can figure out in the IISManager. There look at the properties of the CRM website to find out which application pool is used. Then look in the application pool's properties to find out the identity. Most likely this is "Network Service" but it could be changed in your situation.

After setting the security settings, make sure to perform an IISreset.

- Your environment exists out of multiple servers and the plugin is registered on disk. In this situation make sure that the file is placed in the \server\bin\assembly folder on all servers. Also the security should be set correctly (see other possible reason).

Error:

"The request failed with HTTP status 401 unauthorized"

Possible reasons for this error include
- The code does use a reference to the webservices, but uses credentials which do not have enough privileges in CRM

- The plug-in does is created for the non default instance. In this case, look at the following kb article: http://support.microsoft.com/kb/948746. From there you can request a hotfix for this issue.

Error:


"Not have enough privilege to complete Create operation for an Sdk entity"

This error shows up even though the user is a System Administrator. The cause is that the user is not a member of the Deployment Administrators group in CRM Deployment Manager. Once you have added yourself to that group it will work. Keep in mind that you will need to login as an administrator to be able to open the Deployment Manager.

Error:


"The request failed with http status 400: Bad Request"

This error seems to come from a piece of code in the synchronous plug-in framework which forces the CrmService to use the localhost. George has written a post on the logic behind this.
http://crm.georged.id.au/post/2008/02/22/Synchronous-plugins-want-localhost.aspx
The solution is to either run the plug-in asynchronous or otherwise make the webservice available from the localhost.
Update: There is a hotfix available for this issue now: http://support.microsoft.com/kb/950542

As soon as I run into other issues with plug-ins, I'll definitely add them to this list.