Все просто, почитайте как работать с полем lookup в SDK в разделе Form Programming Reference. Все просто: при выборе значения вы скриптом получаете данные по записи:
Код:
var lookupItem = new Array;
// This gets the lookup for the attribute primarycontactid 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)
{
// The text value of the lookup.
alert(lookupItem[0].name);
// The GUID of the lookup.
alert(lookupItem[0].id);
// The entity type name.
alert(lookupItem[0].typename);
}
После чего можете заполнять этот лукап другим скриптом, например по OnChange при выборе значения другого поля:
Код:
//Create an array to set as the DataValue for the lookup control.
var lookupData = new Array();
//Create an Object add to the array.
var lookupItem= new Object();
//Set the id, typename, and name properties to the object.
lookupItem.id = '{1AAC1363-01A1-DB11-8432-0003FF9CE217}';
lookupItem.typename = 'account';
lookupItem.name = 'A Bike Store';
// Add the object to the array.
lookupData[0] = lookupItem;
// Set the value of the lookup field to the value of the array.
crmForm.all.parentaccountid.DataValue = lookupData;