Multiple relationships between the same entities cause multiple lookups to be populated with the same value

Imagine that you create multiple relationships between Accounts and Contacts. This will create several lookup attributes on the Contact entity which may be added to the Contact form.

When a new contact is created within an Account all the lookup attributes will be populated with the name of the Account. Often this is not desirable but according to this article, http://support.microsoft.com/kb/946599, this is by design.

The article suggests using workflow as a workaround. I’ve found that is it is simpler to use javascript to set the values of lookup fields to null (apart from the main one that links a record to its parent). To do this use code similar to the following in the On Load event of a form – make sure you include the test to see if this is a new form otherwise you will overwrite legitimate values in an existing record.


if (crmForm.FormType == 1)
{
crmForm.all.new_lookup1id.DataValue = null;
crmForm.all.new_lookup2id.DataValue = null;
// and so on
}

Leave a Comment

Your email address will not be published. Required fields are marked *