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.

Enjoy!



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 paint.net.

Within paint.net, 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’
- Run IISRESET
- 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.

USE [MSCRM_CONFIG]
GOINSERT INTO [dbo].[SystemUserOrganizations]
([CrmUserId]
,[Id]
,[OrganizationId]
,[UserId]
,[IsDeleted]
)
VALUES
((select systemuserid from [2011FR2_MSCRM].dbo.SystemUserBase where DomainName='[domain]\[username]')
,NEWID()
,(select id from organization where DatabaseName = '[ORG]_MSCRM')
,(select userid from SystemUserAuthentication where authinfo='[Auth info as copied from the SQL profiler')
,0
)
GO
 



Find missing dependencies when deleting a solution

When deleting a solution in Dynamics CRM, the system checks for dependencies first. If any of the dependencies still exist, then the delete operation will be aborted and the user will receive an error message:

Connot Delete Component (Cannot delete Main because one or more components require it."

The only option for more info, is the Download Log File, but this doesn't tell you really what happened either:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: The Main() component cannot be deleted because it is referenced by 1 other components. For a list of referenced components, use the RetrieveDependenciesForDeleteRequest.Detail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ErrorCode>-2147160033</ErrorCode> <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<KeyValuePairOfstringanyType><d2p1:key>0</d2p1:key><d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">Main</d2p1:value></KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType><d2p1:key>1</d2p1:key><d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string"></d2p1:value></KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType><d2p1:key>2</d2p1:key><d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">1</d2p1:value></KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType><d2p1:key>3</d2p1:key><d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">Solution</d2p1:value></KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<d2p1:key>4</d2p1:key>
<d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string"><a id='a_helplink' tabindex='0' class='ms-crm-Dialog-Error-Link' onclick='openStdWin("\x2ftools\x2fdependency\x2fdependencyviewdialog.aspx\x3fobjectid\x3d\x257b703af1df-aafb-4c61-b97f-da639fbe8d27\x257d\x26objecttype\x3d7100\x26operationtype\x3ddependenciesforuninstall", null, 800, 600, null)'>Details</a></d2p1:value>
</KeyValuePairOfstringanyType>
</ErrorDetails>
<Message>The Main() component cannot be deleted because it is referenced by 1 other components. For a list of referenced components, use the RetrieveDependenciesForDeleteRequest.</Message>
<Timestamp>2015-02-12T12:24:36.2628436Z</Timestamp>
<InnerFault i:nil="true" />
<TraceText i:nil="true" />
</OrganizationServiceFault>

However, there seems to be a little bit of useful info in there. This is the section "\x2ftools\x2fdependency\x2fdependencyviewdialog.aspx\x3fobjectid\x3d\x257b703af1df-aafb-4c61-b97f-da639fbe8d27\x257d\x26objecttype\x3d7100\x26operationtype\x3ddependenciesforuninstall". When replacing some chracters ("\x2f" to "/", "\x3" to "?", "\x3d" to "=", "\x26" to "&", "\x257b" to "{" and "\x257d" to "}"), then you're presented with the url: /tools/dependency/dependencyviewdialog.aspx?objectid={703af1df-aafb-4c61-b97f-da639fbe8d27}&objecttype=7100&operationtype=dependenciesforuninstall. Add "http://[yourserver] to the beginning and you've got your url that'll tell you exactly what dependencies to remove before you can remove the (managed) solution.

A shorter approach, but just as effective would be to take this url and change yourserver and the solution guid:

http://yourserver/tools/dependency/dependencyviewdialog.aspx?objectid={solutionguid}&objecttype=7100&operationtype=dependenciesforuninstall

Your solution guid can be found by opening the solution and pressing F11 or CTRL+N to see the url. In the url take the section between %7b and %7d: https://[yourserver]/tools/solution/edit.aspx?id=%7bC418E1D5-9AFB-E311-90E1-00155D042F50%7d) and you're set to go!



CRM Outlook Client 2011 on a Windows Server 2012?

In some scenario's you might want to install the CRM Outlook Connector for Microsoft Dynamics CRM 2011 on a server which is newer than the Implementation Guide mentions as supported operating systems.
When trying to do so, you'll quickly find yourself facing the following scenario:




The error message is:
The installation has failed. The computer is running an operating system that Microsoft Dynamics CRM does not support. To install this product, you must upgrade your computer to a supported operating system.

Interesting, because you actually need to degrade your computer. However, the next trick will allow you to install the Outlook client after all. Use the properties on the setup file and let Windows figure out the compatibility mode and 'test' the program. This will allow the setup to run and install the add-in.

Please note that I don't recommend this approach as Microsoft may make any update in the future which causes the Outlook Client to have issues.

Here's the process in screenshots:
















Note: when the install doesn't want to pass the Windows Update, then have a look if there's a popup open somewhere started by the Windows Update. This could be an update rollup or any other update that needs your attention as well.

Good luck!