Thursday, September 6, 2007

Getting values from a lookup control

We recently needed to capture both the GUID and the text value from a CRM lookup control. I found some quick code to do this on the following newsgroup:

var lookupItem = new Array;

lookupItem = crmForm.all.primarycontactid.DataValue;

if (lookupItem[0] != null)
// The text value of the lookup.

// The GUID of the lookup.

Quickly getting the GUID of the current form

Here is a quick snippet of javascript code to get the GUID of the current CRM form: