Friday, 12 June 2009

SDK: Read Lookup Value

from: sdk\client\howto\usinglookups


var lookupItem = new Array;


// Get the lookup for the primarycontactid attribute 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)
{
// Display the text value of the lookup.
alert(lookupItem[0].name);

// Display the entity type name.
alert(lookupItem[0].typename);

// Display the GUID of the lookup.
alert(lookupItem[0].id);

// Display the entity type code of the lookup. A value of 1 equals account, and a value of 2 equals contact.
alert(lookupItem[0].type);
}

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home