Friday, May 18, 2012

Changing a document title

Posted in [Dynamics CRM], [Technical] By Amber Butler @ 9/15/2008 10:53 AM

 

 

 

At times it is helpful to change the document title of a form. In case you aren't familiar with the term, the document title refers to the text that appears at the top of the tab or window (depending on your Internet Explorer preferences) of a form in MS CRM.

For example, the document title of the form below is "Account: Microsoft" ... which is the default text for the Account form.

The default text is fine most of the time, but occassionally we identify a need to change the text to provide additional information to the user. For example, the default document title for the case form is "Case:" followed by the case number:

 

When a user glances at the document title, the case number by itself often isn't extremely useful. Some additional information would be helpful, such as the account name or the case title.

The basic steps to change a document title are pretty simple: from within the "Form Properties" of the form, go to the "Events" tab, highlight "OnLoad", and click "Edit". Make sure the checkbox to enable the event is checked, and then enter the following code:

document.title = "Case"

After saving and publishing your customization, the new document title will simply be "Case" whenever you open the case form. That change by itself probably wouldn't be very helpful - so let's now take it a step further. Replace your previous line of code with the following:

var lookup = crmForm.all.customerid.DataValue;

 if (lookup[0] != null) {
    var acctName= lookup[0].name;
}
var caseName = crmForm.all.title.DataValue;

document.title = acctName +": "+ caseName

Now the account name is retrieved through the "customerid" lookup control, and is followed by the title of the case. The resulting document title will be much more descriptive:

 

Popular tags: ,

Comments

Got something to say? Join the discussion »

leave a reply

 [Quick Submit with Ctrl+Enter]

Remember my details
Notify me of followup comments via e-mail

C5_Insight

About C5 Insight

We are a Microsoft Gold Certified partner focusing on SharePoint, Microsoft Dynamics CRM and Salesforce.com.  Learn more about us by visiting our website.

Search

We Wrote the Bible on Microsoft SharePoint and Dynamics CRMBook-Microsoft Dynamics CRM 2011 and SharePoint 2010 Bible

Tags

Maximize

Recent Comments

Maximize

Blog Roll

Maximize

Disclaimer

The information herein may be used solely at your own risk.  No warranty is made by the author or by C5 Insight, Inc.

The opinons expressed herein are those of the individual authors and do not necessarily represent C5 Insight, Inc in any way.

Copyright 2011 by C5 Insight