Пример из SDK:
Код:
var lookupItem = new Array;
// This will get the lookup for the attribute primarycontactid on the Account form.
lookupItem = crmForm.all.primarycontactid.DataValue;
// If there is data in the field, show it in a series of alerts.
if (lookupItem[0] != null)
{
// The text value of the lookup.
alert(lookupItem[0].name);
...