I recently found an issue in Dynamics CRM version 8.1.1. You heard it right and yes I know it’s an older version of CRM. But hey, there are people still on this specific version of CRM. I decided to blog about this issue due to lack of material found on how to resolve this in a supported way so that it can help anyone still using version 8.1.1.

In Dynamics CRM 8.1.1 version while using Internet Explorer if you type an email and either send or save it; you will notice that the recipient of the email will have extra spacing between the lines, making your email look unprofessional.

This only happens in version 8.1.1 and not in earlier or later version. Somehow only this version of Dynamic CRM have this bug.

Luckily I found a supported way to fix it.

Let’s see the issue first and then I will explain why it happens and how to fix it.

Compose an email in CRM; preferably with Regarding field populated.

Img-01

Save it!! and navigate to the record on which this email was created (Regarding) and expand the email in Activity Pane.

Img-02

CRM’s email content editor uses HTML’s editable content attribute which is explained here.

When you press the enter key; content editor on IE converts it into <p> tag but on all other browsers it converts into <div> tag. Adding a <p> is what is causing that extra line spacing.

Resolution:

To resolve this I simply added OnChange event on Description field and converted all <p> tags into <div> tags. Only caveat with this solution is; if user has purposely added <p> tag in the Email Contents then that will be also converted into <div> tag.

Below is the code that should be invoked on change of a description field of Email form.

function Description_OnChange() {
    var description = Xrm.Page.getAttribute("description").getValue();
    var replacedEmailDescription = description.replace(new RegExp('<p>', 'g'), '<div>').replace(new RegExp('</p>', 'g'), '</div>');
    Xrm.Page.getAttribute("description").setValue(replacedEmailDescription);
}

Screenshot below.

Img-03

Screenshot with the fix compared with the old email with extra line spacing.

Img-04

About the Author Danish

Dynamics 365 CE & Azure consultant; passionate to learn new technology and create innovative solutions.

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 )

Google photo

You are commenting using your Google 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: