RE: Javascript for lookup
Hi,
I am not sure that the addPreSearch solution will work for the case that you are looking for.
The presearch allows filtering when you know what you are looking for within the entity.
Xrm.Page.getControl("contactid").addPreSearch(function () {
addContactLookupFilter();
});
function addContactLookupFilter()
{
var fetchXml = "<filter type='and'><condition attribute='lastname' operator='eq' value='james' /></filter>";
Xrm.Page.getControl("contactid").addCustomFilter(fetchXml);
}
In this particular case you want to restrict the values to only one entity.
It is possible that if you have a field in the contact entity that is unique to this, you might be able to achieve it with the addPreSearch. Worth a test.
Try it out...