CRM Watcher

CRM Watcher is the source for the latest Microsoft Dynamics CRM News and Downloads.

Friday, December 22, 2006

Build your own custom lookup dialog (easy and free)

Using a script provided by Curt Spanburgh and some extra tips by Ronald Lemmen, it's easy to build your own custom lookup dialogs.

Below you find the script (sandbox download) that can be used on a form.

crmForm.all.parentaccountid.additionalparams = "fetchXml=<fetch mapping='logical'><entity name='account'><all-attributes/><order attribute='name' descending='false'/><filter type='and'><condition attribute='parentaccountid' operator='not-null'/></filter></entity></fetch>";


For defining your exact query text you can open the Advanced find page in CRM and build the query you want.

Then you can run the query in CRM to see if it returns the data that you want. Press F11 to get the address bar in the Internet Explorer and enter this script; press enter.

javascript:alert(resultRender.FetchXml.value);

If you get a warning about leaving the page, press 'ok'. You can copy all the text on the popup by clicking somewhere on the popup and then pressing ctrl+c.

Then, in notepad you can paste this 'advanced find text' and finally replace the downloaded script text from above with your advanced find text; your custom lookup dialog is there!