A client asked: We have many accounts with multiple contacts. When we want to change the primary contact, the lookup shows all contacts, not just those related to the account. How can we change this?
To display only contacts with the current account as their parent account, you need to make some customizations.
There are two parts to making this work:
* Customize your Contact entity
* Select > Lookup view > click on 'Add Find Columns'
* Check 'Parent Customer' > Save changes > Publish.
Following this change, when you do a lookup for primary contact, you can search by parent company name as well as the person's name. This is useful on its own.
To complete the customiation and do this lookup automatically:
* Customise the Account entity main form > edit the form properties
* Add an onLoad event with the following line of code:
crmForm.all.primarycontactid.additionalparams = 'search=' +
This adds a parameter to the primarycontactid field to pass to the search box when the lookup is invoked (the parameter is the field "name" which is the Account Name of the current Account).
* Save and close > publish Account entity.
Now when you use the Primary Contact lookup from within the Account, you will only see contact that are identified as working for that company (by their Parent Account).