About dsinay

Microsoft MVP in Dynamics CRM, Author of the books Microsoft Dynamics CRM 4.0 Unleashed and Microsoft Dynamics CRM 2011 Unleashed

Getting ready for the CRM 2011 news and updates

Like most of you can find on the web, a great new release of Dynamics CRM 2011 is coming soon.

The list of the new features can be found in the following link http://crm.dynamics.com/en-us/roadmap

I want to focus on the Cross Browser feature here, even though this new functionality will be very welcome for most of the users including us (the developers), most of us might get some big headaches if we don’t be prepared to this change on time. Luckily Microsoft has released a few weeks ago a tool that will help us adapt the JavaScript codes that could be potential issues on the new release, especially with the other browsers like Chrome, Safari, etc.

This tool is called Microsoft Dynamics CRM 2011 Custom Code Validation Tool and can be downloaded from  http://www.microsoft.com/en-us/download/details.aspx?id=30151

Once the solution is installed we will see the tool can be run from the solution itself:

When executing the tool we will be able to see the functions and methods that we will have to pay attention to replace and fix to support the cross browser feature.

The complete list of the incompatible functions between the different browsers that this tool detects can be found on this link

http://blogs.msdn.com/b/crm/archive/2012/06/21/microsoft-dynamics-crm-2011-custom-code-validation-tool-released.aspx

for those that want to start trying the new version on their On Premise environments I recommend following the detailed guidelines that Girish Raja published on this link

http://blogs.msdn.com/b/girishr/archive/2012/05/09/microsoft-dynamics-crm-2011-ur9-a-k-a-r8-beta-is-here.aspx

Do not confuse the number of the rollup update 8, that is already available for download and released on May 2012 that can be downloaded from http://support.microsoft.com/kb/2600644 with the version of the Release 8 which is supposed to be called now the Rollup Update 9.

Regards
Damian Sinay

CRM 2011 ERD Designer

I just released my first CodePlex project, the CRM 2011 ERD Designer!
It can be downloaded from http://crm2011erd.codeplex.com/

The CRM 2011 ERD Designer is a Silverlight 4 application that is packaged as a Managed CRM 2011 Solution. This tool allows you to build ERD (Entity relationship diagrams) that are dynamically updated based on the published CRM entities and Fields; you can create/edit/remove entities and fields from the ERD designer. The tool allows also printing the diagrams.

Image

Note This release is currently in Beta so please provide feedback in the discussion area for any areas of improvement.

The tool has the following Features

o             Add new entity
o             Add new Field
o             Relationship details
o             Save from Entity ribbon
o             Edit Entity
o             Edit Field
o             Edit Relationship
o             Add entity to Diagram
o             Remove entity from Diagram
o             Remove field from Diagram
o             Remove system fields from Diagram
o             Delete Entity
o             Delete Field

Installation

1. Download the CRM 2011 ERD Designer and import it into CRM 2011 On Premise or CRM Online.
2. Refresh the browser.
3. You can then access CRM 2011 ERD Designer within the Settings Area by selecting ERD Diagrams under the Extensions menu option.

Note: As it is a managed solution it can be completely removed from CRM by selecting to delete the solution from the Solutions View in CRM.

To make this project I used the following components

o             Silver Diagram SDK
o             MVVM Light Toolkit
o             CRM Developer Toolkit
o             Silverlight Control Toolkit
o             Menu and Context Menu for Silverlight 4.0
o             MEFedMVVM

So if you download the source code and want to build the solution you will need to

1) Download the Silver Diagram SDK from the SilverDiagram site (just copy the SD.XXXX DLL’s).
2) Download the CRM 2011 SDK from Microsoft site and install the Developer Toolkit that is inside the sdk\tools\developertoolkit folder
3) Download the MVVM Light Toolkit from Codeplex site.
4) Download the Menu and Context Menu for Silverlight 4.0 fromCodePlex site
5) Download MEFedMVVM from CodePlex site

Enjoy It!
Damian Sinay

Using encodeURIComponent when using ODATA queries in JavaScript and Dynamics CRM 2011

This week I ran into an issue that took me a while to figure related to the ODATA queries in Dynamics CRM. This might be a common mistake for other CRM and ODATA REST developers so I wanted to share it here.

Problem description

Here was the most difficult thing; there was not error at all and neither any error message. The JavaScript code that was put on an entity form customization just didn’t work as expected. It was not returning a record that we knew existed in the CRM system. The code looked similar to this

       var serverUrl = Xrm.Page.context.getServerUrl();
       var ODataPath = serverUrl + “/XRMServices/2011/OrganizationData.svc”;

       var contactReq = new XMLHttpRequest();
       contactReq.open(“Get”, ODataPath + “/ContactSet?$filter=EMailAddress1 eq ‘” + email + “‘ and StatusCode/Value eq 1”, false);
       contactReq.setRequestHeader(“Accept”, “application/json”);
       contactReq.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”);
       contactReq.onreadystatechange = function () {
                  contactEmailReqCallBack(this, changes, a, guid);
       };
       contactReq.send();

 

Basically this code requests a contact by looking at a specific email address that is passed to the parameter email. On my case the code was working for some emails and not for others, I realize the ones that were not working were like firstname+lastname@gmail.com for example. So the URL was formed as follows

http://crm2011/org/XRMServices/2011/OrganizationData.svc/ContactSet?$filter=EMailAddress1 eq ‘firstname+lastname@gmail.com‘ and StatusCode/Value eq 1

it didn’t return any record even though there was a contact in the CRM system with that email address. So, what was the problem here? The problem was the + sign is interpreted as space in the URI as well as other characters might be wrongly interpreted, like for example the / char.

The solution

Use the encodeURIComponent function to encode the email address properly in the URL. Our code changed now looks as follows:

       var serverUrl = Xrm.Page.context.getServerUrl();
       var ODataPath = serverUrl + “/XRMServices/2011/OrganizationData.svc”;

       var contactReq = new XMLHttpRequest();
       contactReq.open(“Get”, ODataPath + “/ContactSet?$filter=EMailAddress1 eq ‘” + encodeURIComponent(email) + “‘ and StatusCode/Value eq 1”, false);
       contactReq.setRequestHeader(“Accept”, “application/json”);
       contactReq.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”);   

contactReq.onreadystatechange = function () {
    contactEmailReqCallBack(this, changes, a, guid);
};
contactReq.send();

Conclusion

Never forget to use the encodeURIComponent function when passing parameters on your ODATA queries!

I hope this helps others to ovoid a problem like the one descripted here.

For all who like to work with ODATA services in Dynamics CRM here is a great tool that will help creating the queries. http://crm2011odatatool.codeplex.com/