// executionContext is passed as function parameter
var formContext = executionContext.getFormContext();
// Get lookup field as array
var customer = formContext.getAttribute("customerid").getValue();
// Get entity type for customer index 0 for example account
var customerEntityType = customer[0].entityType;
// Get GUID for example {80AC35A0-01AF-EA11-A812-000D3A8B3EC6}
var customerId = customer[0].id;
// Get entity logical name for example Alex Baker
var customerName = customer[0].name;
Source: attribute.getValue (Client API reference)