By default, customer fields are open to accounts, contacts, and sometime leads. A common request is to lock down a customer field to a particular entity type or set of entity types. For example, you may want to lock down the customer field on opportunity to only accounts (not a contact). There is a simple fix to handle this. Simply add this line to only allow accounts to be selected (entity type code of 1).
crmForm.all.customerid.setAttribute("lookuptypes", "1");
The problem is that users can get around this by converting an activity such as a phone call to an opportunity. If you create your phone call from a contact then it will set the customer to the contact. The fix is to add code to OnLoad that verifies the customer field. If a contact is selected then it will reset the customer field to the contact’s parent account. If they don’t have a parent account then I blank out the field. Since this field is a required field on opportunity, the user is required to specify a valid account in the customer field before saving.
No comments:
Post a Comment