New Example of Javascript OnChange Code For CRM 3.0

Thanks to Arne Janning for the assist on this one. Here's a sample script that can be added to the OnChange event to dynamically create a title on a case form. Here's how it works. The script sits in the "Case Type" picklist. The user is required to select a customer (or patient, in the case of this code) and a subject for the case. When they select the case type, the OnChange event pulls the values from the Customer and the Subject and concatenates them into the Title field of the case form. This is a pretty simple use of the OnChange functionality, but because of the paucity of examples out there, I thought I'd throw it up here.

var strPatient;
var strSubject;
crmForm.title.value=strPatient+": "+strSubject

Patient: John Smith
Subject: Therapy
Type: (Selected from picklist)
Title: John Smith: Therapy

Here's a reference in the 3.0 SDK for Field Type: Lookup or PartyList


Anonymous said...


The SDK says I should be able to get the other attributes as well. I've tried to chanmge name to another attribute and it just comes back undefined.
I then tried the example as per SDK using my Custom entity and the second line allocating the data to the array crashes - any ideas

Pete (p0911@hotmail.com)

Anonymous said...


I got the same thing: undefine when changing name to some other attributes. How did you solve the problem.


Anonymous said...

I want to set the title using the origin window title.
for example, when openning a contact from account "ABC" the title would be "John, ABC".
Any ideas?

Anonymous said...

I want to create a title to a form that use the origin title.

for example, form account "ABC" one open contact "John"
I want the form's title to be "John, ABC"

the problem is having the origin's title (or any properties)

ICU MSCRM © 2004-2009