April 2, 2010 Leave a comment
Have you noticed when searching for a customer address using the built in Address dialog that only addresses with a Name value are returned. I’ve had instances where the default address name field has been used as House Name and as we all know not all houses have a name.
If you have look at the code that is used to open the Address Lookup it calls an aspx page named lookupsingle.aspx and passes a querystring parameter ‘class’ with a value of ‘BrowserCustomerAddress’. BrowseCustomerAddress is the title of an xml file found in the ‘Microsoft Dynamics CRM\Applications Files’ folder as BrowseCustomerAddress.xml. This file contains the query elements that the Address dialog uses to retrieve the specific customer addresses. A number of fields and also 3 conditions exist in this file and you will notice that one condition relates to the name field with an operator value of not-null. If you remove this condition node from the xml file, save it and then test your address dialog, you will now see all of the addresses for a customer. This is unsupported so only perform this if absolutely necessary and your aware of the implications.
To reuse the Address dialog on your own entities or where the Address Lookup is not available , for example to fill custom address fields on a Case, then Dave Berry has a good example here of how to utilise the standard MSCRM Address Lookup dialog for your own use.
For a more customised approach then there is an MSDN article here on how to retrieve data for a related entity, in this case it demonstrates retrieving addresses.