CRM 2011: Filter the customerid lookup field on quote form

And here we go for another highly unsupported customization.

This one has the following assumptions:

  • You know customerid is used only for showing contacts
  • There is another field on the form to show accounts, named new_AccountId
  • You want customerid to show only contacts from the selected account
  • You have jquery, otherwise the code will be slighly different and longer, but it’s of course possible

Here’s the code to run in the onLoad of the quote form:

 

$(‘#customerid’).attr(‘relationshipid’, ‘contact_customer_accounts’);
$(‘#customerid’).attr(‘dependantattributename’, ‘quote.new_AccountId’);
$(‘#customerid’).attr(‘dependantattributetype’, ‘1’);

 

And your lookup is filtered!

Leave a Reply

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