First off, I have tested this only in CRMOnline on 8.1.0 and so this might not work for you if you are are in older version. You can now easily restrict the default entity of the lookup, if it links to multiple types. e.g. customer lookup. The script below is for attribute of type “customer”, but you can follow a similar approach for “partylist” as well.
These new functions are undocumented, so they are technically unsupported. So, use this at your own risk. In the script below, I am restricting a field with schemaname “customerid” and of type “customer” to “contact” entity only.
JavaScript
var lookupData = Xrm.Page.getAttribute('customerid').getLookupDataAttribute(); //check if multiple type dropdowns enabled for this lookup and it is not a partylist. For partylist we might want to select an account and a contact if (lookupData.getSupportedLookupTypes().length > 1 && !lookupData.getIsPartyList() && lookupData.getSingleLookupTypeId() !== 2) { lookupData.setLookupTypes(['contact']) }
Screenshots
You can use this script during form load and easily restrict the lookup type.
