Lookup field allow you to insert a sort of “link” to a related record, allowing you to use also a wild card research.
This image shows how a lookup field looks like in the entity form before you choose a related record to insert:
It’s possible to use javascript to do custom action on this kind of field.
The following code shows you how to get and set lookup fields.
Get a lookup value
var lookup = new Array();
lookup = Xrm.Page.getAttribute(“attribute”).getValue();
if (lookup != null) {
var name = lookup[0].name;
var id = lookup[0].id;
var entityType = lookup[0].entityType;
}
Set a lookup value
Xrm.Page.getAttribute(“attribute”).setValue([{ id: recorid, name: recordname, entityType: entityname}]);