There are a few lookups in CRM call Customer lookups and can be either Accounts or Contacts.
I have to say I often find these annoying. Often on the Case form I have to add an account lookup so the user can specify an account and a contact. The problem is when I use the Customer lookup it defaults to account lookup.
The Customer record is locked onto the form so you can’t get rid of it (you can hide it and assign it a value if you wanted but that’s a bit messy and extra fields etc.)
So on this form I added an account lookup and then used the customer lookup to specify a contact and I wanted a way to default the lookup to be a contact lookup.
I found some code shown below on the blog MSCRM Bing’d which is written by CRM MVP Rhett Clinton.
document.getElementById("customerid").setAttribute("defaulttype", "2"); <pre>Xrm.Page.getControl("customerid").setDefaultView("a2d479c5-53e3-4c69-addd-802327e67a0d");
To get this solution to work I had to go and get the guid of the contact view and in this case I wanted the Active Contacts and replaced the SetDefaultView guid with my guid and then I put the code into the onload event.
Then when I clicked on the customer lookup it defaults to contacts and the view I specified in the guid.
The only downside is if you search in the box without pressing the lookup button it does still search contacts and accounts.
So a big thanks to Rhett for helping resolve a problem which had annoyed me for quite a while.