Saturday, 30 June 2012

Dynamics CRM 2011 Map solution with OpenStreetMap

I have seen a few tutorials online regarding how to set up Maps with Google or Bing, however this solutions require a license depending how you use them so why not use a free and powerful opensource map solution on your Dynamics CRM 2011 with OpenStreetMap? And the most interesting part you can do that with only two simple configuration steps.

OpenStreetMap is a powerfull worldwide map created by volunteers. You can read more here:

To implement OpenStreetMap on Dynamics CRM 2011 we use the following services:
  • GeoNames (to lookup post codes) -
  • OpenLayers (free javascript map library) -
  • OpenStreetMap layers
  • Jquery

Step 1 - Create a HTML webresource
 Navigate to Settings > Customizations > Customize the system > click on web resources and click new.

Click Text Editor > click tab source > < paste the below code:

When you save it, you can ignore the error messages $. is undefined. Save and Publish.

Step 2 - Customize your entity
using the account entity start by creating a new section called map:

1.  Customize the main Account form, click the insert tab and select One column Section.

2. Confirm is set to one column and click OK

3. High light the section on the form and go to insert > Webresource and add the osmap_loader

Click ok, Save and Publish.


Open an account make sure the postal code is not empty:

You can navigate around, and zoom in and out.

Hope you enjoyed this tutorial, is pretty straight forward and completely free of charges.

The solution above uses the Postal code lookup API from GeoNames however GeoNames have  more API's that can search for addresse's cities etc, lookup GeoNames services here:
Note: On the javascript above code I'm using username=nrodri which is my username, you can register an account for free and replace my username. with a custom username the service gives you 30k lookups a day.

Note that I'm loading the jquery library and openlayers library on the form, if you have a heavily customized form, this can add some extra load time, my advise would be to collapse the tab and allow users to expand the map as they needed, this way the map will only be loaded when you expand the tab.

Friday, 22 June 2012

Dynamics CRM 2011 Disable Pending E-mail Warning

I needed to disable the below Pending e-mail warning message which pops-up every time you log on to CRM, I couldn't find online the registry key to disable it, so had to "sniff" the registry keys CRM is loading  and the following key come up:

Name: DisablePendingEmailReminder
Value: 1

Reset IIS.

Saturday, 16 June 2012

Dynamics CRM 2011 Report Error 'Sys' is undefined and 'Type' is undefined

On a load balanced environment with multiple front-end servers users receive intermitent report errros with the following error messages:
Message: 'Type' is undefined
Line: 5
Char: 1
Code: 0
Message: 'Sys' is undefined
Line: 1228
Char: 1
Code: 0
 URI: ...
Message: Object expected
Line: 993
Char: 1
Code: 0

I found that the reason for the above errors were related with front-end servers configured with different machine keys, when the traffic hits SERVER1 and if the following request's hit SERVER2 the decryption key will be unable to process the request's causing those errors.

Configure all front-end servers with the same Encryption and Decryption Machine key:

Open IIS and High light Microsoft Dynamics CRM website

Double click Machine  Key

Click on the right generate machine key:

Copy those keys onto all front-end servers.

This should fix the issue. Also confirm you have all SPN's correctly configured for your service accounts.

Wednesday, 6 June 2012

Dynamics CRM troubleshooting user access issues

As time passes, I've realised that in particular with dynamics CRM 4, often I get user account and tenant relationships messed up on the database. CRM fails to create all the user relationships between those tenants. Issues that you may find:
  • User account is visible on the users list and has a security role, however user can't authenticate.
  • You can't assign a security role to a specific user on a specific tenant.
  • User can't connect via Outlook client, with organizationId error.
  • User can't run reports (not a member of ReportingGroup).
The above situations  are typical symptoms of user and tenant relationships not created on the database. A quick way to troubleshoot and understand how the user account relates with different tenants, is illustrated on the below diagram:

As you can see above the Organization database links to the SystemUserOrganizations, so this means on the MSCRM_CONFIG you should have one entry for each tenant the user is member of. The diagram can help you to quickly identify User and Tenant relationships.

Note: for the situation where the user can't run reports, just add the user to the ReportingGroup.

Hope this was useful :)