Restore removed sitemap entries

In Dynamics CRM you can work with solutions that stack on top of other solutions. This does require some careful planning and consideration during development as a change in one organization impacts other organizations. One of these changes are changes to the sitemap. If you add a sitemap entry in one solution and remove this in the second, then in a 3rd organization this entry will not be visible. However, how do you restore this entry?

CRM will place the following actions in the sitemap node of the customizations file when you export this as a managed solution. For the first solution where you add the sitemap entry:
<SubArea Entity="cht_yourentity" Id="cht_yourentity" AvailableOffline="false" PassParams="false" ordinalvalue="0" />

In the export for the second solution where you remove the sitemap entry:
SubArea Entity="cht_yourentity" Id="cht_yourentity" AvailableOffline="false" PassParams="false" ordinalvalue="0" solutionaction="Removed" />

As you can see, the solutionaction is removed. So, how can you remove this solution action?

Dynamics CRM is generating the actions based on the current state of the sitemap compared to the other existing (managed) solutions. This means that if you add a new sitemap entry in the second solution, then this will not be recognized as a difference and hence the solutionaction will be removed.

In short, just add a new sitemap navigation entry and this will solve your problem.


Dynamics CRM instruction video's in Dutch!

Just recently Microsoft has started to provide instruction video's not only in English, but also in other languages. And, one of these foreign languages is Dutch!

You can find the first video's on Youtube's channel "Microsoft Dynamics CRM Product Information Dutch"

The currently available video's are:
- Aan de slag met Microsoft Dynamics CRM 
- Nieuwe navigatie voor Microsoft Dynamics CRM Online 
- Microsoft Dynamics CRM voorjaar 2014 - Wachtrijverbeteringen 
- Microsoft Dynamics CRM voorjaar 2014 - Overzicht van servicebeheer 
- Snelle tips voor CRM voor tablets 
- Snelle tip voor CRM 2013: snel toegang tot klantgegevens in Microsoft Dynamics CRM 
- Snelle tip voor CRM 2013: voeg snel nieuwe informatie toe via snelkoppelingen 

Change the AggregateQueryRecordLimit for 1 organization

In CRM there are a couple of thresholds created to guarantee performance of the application. Though this is a good thing, it does cause some issues every now and then. One of these thresholds is the AggregateQueryRecordLimit.

You will find that CRM uses this threshold as soon as you want to view a chart or execute an aggregation in a report over more than 50.000 records. If this is the case, then CRM will present you with the error message "AggregateQueryRecordLimit exceeded. Cannot perform this operation.".

Multiple guys have posted about changing this setting (hint:
update DeploymentProperties set IntColumn = 250000 where ColumnName = ‘AggregateQueryRecordLimit’), but this allows every organization in your instance to exceed this threshold, while you might only want to allow one organization to do this.

Though it is not documented in the SDK, it is possible to set this value for just a single organization. Just as easy as updating the deploymentproperties table, you can also add a record to the organizationproperties table (in the MSCRM_CONFIG database):

INSERT INTO MSCRM_CONFIG.dbo.OrganizationProperties (Id, ColumnName, IntColumn)
VALUES ('8CB2768E-1585-E411-80BC-D4490D33C5AC', N'AggregateQueryRecordLimit', 250000)

Obviously you'll need to replace the guid with the ID of your organization (select id, FriendlyName from Organization) and the number in the end with the amount of records you would allow to be aggregated.


Create icons for Dynamics CRM 2013/2015/Online

Back in the days of Dynamics CRM 2011 full color icons were the default, but now Microsoft has changed the look and feel. This new user interface of Dynamics CRM does require you to rethink how to work with icons. The larger icons appear to be blueish and white when you hover over them, while the smaller icons are grayish.

The guys at Magnetism have done a great job describing where these icons are displayed, however it would also be useful to have some guidance on how to create these new icons. You can of course go back to a designer and have this done for you, but there are some easy tricks to get existing icons updated or redesign any of the free resources to match the new UI.

First of all, it's good to know that the icons in the menu bar which appear as light blue, aren't actually blue. The icons are white (RGB: FFFFFF), but CRM renders them in light blue until the user hovers over. This means that while developing your 32x32 pixel images, you can make them white. An easy and cheap approach to do this, is to use

Within, you can open the image:

 Then go to "Adjustments" -> "Curves":

Drag the dot from the left top to the right top. You'll see the code change from (0, 255) to (255,255):

And your image appears in white.

The smaller images, only used for entities, the color is in gray shades. You can either use the same approach as above to transform the image to gray, but an even easier approach is to use the black & white option:

After saving your images, then you can upload them to CRM as a web resource and start using them in the sitemap or as entity icons.

Multiple CRM servers, ADFS and the pesky "An error occured"

If you have multiple Dynamics CRM 2011 machines configured to use the same ADFS server, then you will probably run into this error message:

An error occured:
Try this action again. If the problem continues, check the Microsoft Dynamics CRM Community for solutions or contact your organization’s Microsoft Dynamics CRM Administrator. Finally, you can contact Microsoft Support.

In the URL you can find more details about the error message, which will lead you to this error message:

A CryptographicException occurred when attempting to decrypt the cookie using the ProtectedData API (see inner exception for details).  If you are using IIS 7.5, this could be due to the loadUserProfile setting on the Application Pool being set to false.

This has to do with the fact that your first CRM server is providing a cookie to the user which is being reused to authenticate against the second CRM server. This doesn't match, resulting in the error above.

The same scenario exists for a load balancer where you have multiple CRM servers which access the same CRM database. This led me to the blog of Dan Brunn, which describes how to get past this for an NLB environment:
- Open the CRM Deployment Manager - Microsoft Dynamics CRM Properties - Web Address tab - Advanced
- Check the ‘The deployment uses an NLB’
- Re-test

After testing this approach, we found that this also works for the scenario where you have multiple CRM servers behind the same ADFS server.

Forum posts have indicated that not everybody is having the same amount of luck with this approach. I would recommend to follow the ADFS best practises from Chris Cognetta to double check the ADFS settings.

Find out deployment administrators

When starting the deployment manager (start -> programs -> microsoft dynamics crm ->deployment manager) you might get the bugged with a message when you're not the deployment administrator of the machine. This even happens when you're domain admin, sys admin on the database and/or local admin on the machine:

"Only the Deployment Administrators are able to use the deployment manager"

The only way to start the deployment manager, is when you're a deployment administrator. And guess what, the only place to add you as a deployment administrator is within the deployment manager tool. Catch 22? Not really, because the person who installed Dynamics CRM is added as a deployment administrator automatically. However, if you have no clue who this is, then you can get this information from SQL server.

The following query will provide you with a list of all the deployment administrators of your environment:
SELECT Name, IsDisabled, Name, IsDeleted FROM [MSCRM_CONFIG].[dbo].[SystemUser]
WHERE DefaultOrganizationId ='00000000-0000-0000-0000-000000000000'

How to find out which SQL server is used by CRM? You won't believe it, you can get this information from the servers tab in the deployment manager* ;)

*or windows register: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM

Restore missing user in MSCRM_CONFIG

In some rare scenario's you'll not be able to login to CRM though you are sure that you're use has been added to the organization and you have a security role as well. The pesky error message generally is:

404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.

If this is the case, then it could be that your user is missing in the MSCRM_CONFIG database. Especially if you're moving around database with backup and restore, then this could happen. If you think this could be the case in your scenario, then make sure to start a SQL profiler and grab the entry that shows up when refreshing the page. It would like like this:

exec sp_executesql N'exec p_GetCrmUserId @OrganizationId, @AuthInfo',N'@OrganizationId uniqueidentifier,@AuthInfo nvarchar(46)',@OrganizationId='0474D466-1234-E311-1234-A02B3F591536',@AuthInfo=N'W:S-1-5-21-123456789-1234567890-123456789-1234'

When executing that query against the MSCRM_CONFIG you should not get any result. If this is indeed the case, then you can add your user back into this table with the query below. The usual statements apply, backup first, unsupported and only execute this when you know what you're doing.

GOINSERT INTO [dbo].[SystemUserOrganizations]
((select systemuserid from [2011FR2_MSCRM].dbo.SystemUserBase where DomainName='[domain]\[username]')
,(select id from organization where DatabaseName = '[ORG]_MSCRM')
,(select userid from SystemUserAuthentication where authinfo='[Auth info as copied from the SQL profiler')