}
The addParentAccountEventHandler function is called when the form is loaded to hook up the handler to the PreSearch event.
The addParentAccountFilter function runs when the events fires and it creates a filter condition to filter accounts only where the primarycontactid matches the opportunity contact id. The filter condition is then added to the lookup control by calling the addCustomFilter method. Only those accounts with a primary contact matching the opportunity contact are displayed.
While this technique is relatively straight forward and easier to implement than the 2011 addCustomView technique it would have been great if this could have been achieved using business rules eliminating the need for any javascript,