Home > Uncategorized > Viewing a Logo in Microsoft CRM

Viewing a Logo in Microsoft CRM

I’m always getting the question on how to view a logo or image in Microsoft CRM.  Well here is a quick customization you can add to your account form and view a logo.   Once you add this script on the ‘OnLoad‘ event of the form, all you need to do is add an image called ‘logo.jpg’ as an attachment and everything will show up properly.   This customization will even work offline.


var Loaded = false;

if(crmForm.FormType ==2 || crmForm.FormType ==3 || crmForm.FormType ==4)
    // get the notescontrol object
    var oNotes = document.getElementById("notescontrol");

    // attach an event so we know when the notecontrol is done loading
   oNotes.attachEvent(‘onreadystatechange’, LoadLogo);

   // refresh the notecontrol

function LoadLogo()
   if (oNotes.readyState != ‘complete’)

   var oDoc = (oNotes.contentWindow || oNotes.contentDocument);
   if (oDoc.document) oDoc = oDoc.document;
   // attachment use SPAN tags
   var attachments = oDoc.body.getElementsByTagName("SPAN");

   //Iterate through all the attachments.
   for (var i = 0; i < attachments.length; i++)
       // let’s be certain we have an attachment here
       if (attachments[i].attachmentId)
            // is this an image attachment
            if (attachments[i].innerHTML.match(/.*logo\.jpg$/i) && !Loaded)
                  //Get a reference to the table
                 var tr = crmForm.all.name.parentNode.parentNode.parentNode.insertRow();
                 var td = tr.insertCell();
                 td.innerHTML = "<img src=’" + attachments[i].url.concat("?AttachmentType=", attachments[i].attachmentType,                                    "&AttachmentId=", attachments[i].attachmentId) + "’/>"
                  Loaded = true;

When your done, your form should look like this.

If you really want to get creative you can go a little further and build a viewer to page through all images that are attached to the record.




This customization may not be supported by Microsoft and is provided as-is with no warranty.

Categories: Uncategorized
  1. Michael
    March 31, 2007 at 11:59 am

    So, one could display a consistent logo on every form created if you were to, say, set up a "Create" WF Rule that adds the this logo in a Notes Attchment?

  2. Daren
    March 31, 2007 at 9:44 pm

    As long as you have the script on the \’OnLoad\’ and you wanted to automate the addition of the logo via WF rule… yea.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: