Customer
![]() |
[Applies to: Microsoft Dynamics CRM 4.0]
Find the latest SDK documentation: CRM 2015 SDK
A Customer field represents a type of Lookup where either an account or contact is a valid type of record. The following properties are available:
| Customer or Regarding properties | Type | Description |
| {Field}.DataValue | Specifies an array of lookup objects. For the Customer field this array always has a length of one. DataValue is Null when no value is selected. Set DataValue to Null to make the lookup field blank. |
Example
The following code example shows how to use a Customer field type.
var customer = new Array();
customer = null;
// This gets the lookup for the attribute customerid on the Opportunity form.
customer = crmForm.all.customerid.DataValue;
// If there is data in the field, show it in a series of alerts.
if (customer[0] != null)
{
// The name of the customer.
alert(customer[0].name);
// The GUID of the customer.
alert(customer [0].id);
// The entity type name of the customer.
alert(customer[0].typename);
}
See Also
Concepts
Other Resources
.gif)