Darren Liu's Blog

Archive for the ‘Development’ Category

CRM 2011 – IE 7,8 9 Hangs

leave a comment »

I ran into a problem today that CRM IE7, 8, 9 hangs after 30 minutes because I have many XmlHttpRequest calls on the form.  I found a blog on MSDN that helped me out and I believe all of the us as a CRM developer should pay attention to.  The title of the blog article is Why You Should Use XMLHttpRequest Asynchronously, it’s a good read.


Written by darrenliu

08/27/2012 at 3:28 pm

Reference an image in Web Resource from Site Map or Ribbon

with one comment

CRM 2011 has this excellent solution concept which I like it a lot!  If you can master on how to leverage solutions in CRM 2011, it’s quite powerful when you are doing customizations in CRM.  When doing Site Map or Ribbon customization, I often need to reference to an image. 

In the previous versions of CRM, I have to place the images into the ISV or the IMG folder under the CRM web site, and then reference to that image path.  CRM 2011 has totally changed, it’s trying to stay away from the ISV folder and everything now has to store in the Web Resource. 

So what is Web Resource?  You may just think of Web Resource as a folder within CRM that you can upload files to, it stores HTML pages, Silverlight Controls, Images, XML files and etc… If you would like to use them in CRM form, you can just insert them on to the form.  If you like to use them in Site Map or Ribbon, all you need to do is to use the $webresource: directive to specify a Web resource image to use as an icon in the ribbon or in the application navigation using Site Map. The following sample shows how to specify icons for a button in the ribbon.

<Button Id="MyISV.opportunity.form.actions.FlyoutAnchor.Button.1"

So if you want to reference an image in Web Resource from Site Map, follow the steps below:
  1. Upload the image to Web Resource.
  2. Export Site Map.
  3. Update Site Map and use $webresource: directive to specify a Web Resource image.
  4. Import Site Map.
  5. Publish All Customization.

Written by darrenliu

02/07/2011 at 6:47 am

Posted in CRM, Customization, Development

Tagged with

Display an HTML Web Resource in a Form with No Border

with 4 comments

When you add an HTML Web Resource to an entity form a border will be displayed even when you do not check the Display Border checkbox of the formatting tab of the Web Resource Properties dialog box.


To prevent a border from being displayed, set the style properties of the body element of the HTML document. You must also not include any DOCTYPE information. The following HTML will cause the HTML Web resource contents to display without a border.


<title>No Border Web Resource</title>
<body style="border-width: 0px; padding-left: 0px; padding-top: 0px; margin-left: 0px; margin-top: 0px; margin-bottom: 0px; margin-right: 0px">
This Web Resource will display with no border</p>

By default, many HTML editors will include DOCTYPE information in the contents of the HTML. The following HTML with the same body style applied will still appear with a border.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<title>Web Resource with Border</title>
<body style="border-width: 0px; padding-left: 0px; padding-top: 0px; margin-left: 0px; margin-top: 0px; margin-bottom: 0px; margin-right: 0px;">
Style applied but border still appears.</p>

Thanks Jim Daly again for the information and I hope it helps you on your project.

Written by darrenliu

01/28/2011 at 1:14 am

Posted in CRM, Development

Tagged with ,

Turn RSS Feed Reading View Off

leave a comment »

I am working with CRM using the REST endpoint today and I would like to see the XML returned by the Organization data service in Internet Explorer.  However I forgot how to turn the Feed Reading View off (if you have feed reading view on, you will not able to see the XML).  So I “bing”…  I found the answer and I would like to put it on my blog for my future reference and also for the folks who is looking to do the same during CRM development.  So to turn Feed Reading View off, I need to follow the steps below.

  1. Click on the Tools menu.
  2. Select Internet Options from the dropdown menu.
  3. Click on the Content tab on the Internet Options property screen.
  4. Click on the Settings button of Feed section to bring up the Feed and Web Slice Setting dialog box.
  5. Uncheck the check box for Turn on feed reading view.


  6. Click OK button to close all of the open dialog boxes.
  7. Restart Internet Explorer.





Here we go, I can now see the XML returned by the Organization data service!  Anyway, happy coding everyone!

Written by darrenliu

01/27/2011 at 1:34 am

Could not load file or assembly ‘Microsoft.IdentityModel’

leave a comment »

I ran into a problem trying to authenticate with CRM 2011 Online, I received the following error message when I tried to run my code:

Could not load file or assembly ‘Microsoft.IdentityModel Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencie. The system cannot fine the find specified.

The reason for receiving this error is because I don’t have the Windows Identify Foundation Pack installed on my Windows 7 machine.  To resolve this problem, I downloaded and installed the Windows Identity Foundation Pack.

Written by darrenliu

01/20/2011 at 7:20 am

Posted in CRM, Development

Tagged with ,

CRM 2011 Style Templates

with 6 comments

I am currently working on a CRM 2011 project and I need to extend CRM to integrate with other systems.  The programming paradigm has shifted from server side programming to client side programming in CRM 2011.  In order to have a seamless integration between the two applications, I reverse engineered the current CRM 2011 CRM form page and created three HTML templates so I can leverage it in my current project.  The reason that I created HTML pages is because CRM 2011 stores all of the components in the web resources. HTML, CSS and Silverlight are the some of the supported components.  I uploaded the source code to CodePlex, you may download and use it at your own discretion.  I hope these templates helps you in your CRM 2011 projects.

CRM 2011 Main Form


CRM 2011 Main Form Area


CRM 2011 Lookup Form


Written by darrenliu

12/03/2010 at 12:52 am

Retrieve Plug-in/Custom Workflow Activity DLL from Database

leave a comment »

I ran into an issue today that the client can’t find the plug-in project that some independent consultants built a year ago.  Since they can’t get in touch with the consultants who wrote the plug-in, they have two options to get retrieve the code.  One option was rewrite the plug-in from scratch and the other option was to retrieve the plug-in from the CRM database since the plug-ins are registered in the database.

To rewrite the plug-in code would require a lot of effort, so they chose the second option.  To retrieve the custom plug-in from CRM database is easy.  Here are the steps to do that.

  1. Retrieve the Plug-in encoded string from the Organization MSCRM database.  The plug-ins are stored in the Plugin PluginAssemblyBase table.
    SELECT Content FROM PluginAssemblyBase
    WHERE PluginAssemblyId = '[Plugin Guid]'
  2. Copy and paste the Content string into a text file.
  3. Write a simple C# command line application to convert the plug-in string to DLL.
    string inputFileName = "Plugin.txt";
    string outputFileName = "Plugin.dll";
    FileStream fileStream = File.Open(fileName, FileMode.Open);
    byte[] buffer = new byte[fileStream.Length];
    fileStream.Read(buffer, 0, buffer.Length);
    ASCIIEncoding encoding = new ASCIIEncoding( );
    this.buffer = encoding.GetString(buffer);
    FileStream fileStream = new FileStream(outputFileName, FileMode.Create);
    byte[] buffer = Convert.FromBase64String(this.buffer);
    fileStream.Write(buffer, 0, buffer.Length);
  4. After you retrieved the DLL from the database, then you may use .Net Reflector to extract the code from this plug-in.

That’s it! Just in case you run into the same situation that you have to retrieve your plug-in or custom workflow activity from MSCRM database, you can follow the steps above.  I hope this helps!

Written by darrenliu

08/04/2010 at 7:47 pm

Posted in Development