Blog, Development

Microsoft Dynamics 365 v9.0: lookupObjects – closer look

After I posted my previous post about new namespaces and methods I got several questions about lookupObjects method from Xrm.Utility namespace. I decided to make additional research to check what was not documented but can be used.

Here is url that contains description of method with standard parameters:

And here is the list and usage of additional parameters that are not documented but can be set using JavaScript:

    1. Lookup form properties:
      • disableViewPicker – boolean, when set to “true” disables dropdown with views (default value is “false”)
      • disableQuickFind – string, when set to “1” disables “Quick Find Search”
      • lookupBrowse – boolean, when set to “true” hides whole section related to search (“Look For”, “Look In” and “Views” dropdown)
      • showNew – boolean, when set to “true” adds “New” button to lookup dialog (default value is “false”)
      • searchText – string, when populated, passes that value to “Search” field of lookup dialog
    2. Additional prefiltering – the same possibilities like we have with addPreSearch/addCustomFilter. If you want to use this feature you will have to pass both following parameters – customFilters and customFilterTypes:
      • customFilters – array of url-encoded string filters, example –
      • customFilterTypes – array of strings. When you have one entity or you want to apply the same filter for all available entities just pass [“”], when you have several entities and you want to apply different filters for entities you will have to pass array with names of entities along with array of filters
      • example of code for single entity or the same filter for all entities:
      • example of code for multiple entities and different filters:
    3. “Related Records Filtering” – filtering of lookup dialog through code settings the same way as it described here through customization:
      • allowFilterOff – boolean, when set to “false” disallows user to turn of filtration applied
      • filterRelationshipDependantAttribute – string, name of attribute in related entity in format “relatedentityname.attributename”, example – “contact.parentcustomerid”
      • filterRelationshipId – Guid, id of relationship
      • filterRelationshipName – string, name of relationship used for join
      • filterRelationshipType – string, use “1” when want to turn on “Related Records Filtering”
    4. customViews – array that you can use to add any custom views you want to show in View Picker – the same functionality that you can get using addCustomView method of lookup control. Here is example of usage:

3 Comments on “Microsoft Dynamics 365 v9.0: lookupObjects – closer look

  1. Hi,

    Could this work on Connection Entity’s ‘record2id’ lookup field which looks up to several other entities? I want to restrict them down to only a few entities. Kindly advise.

    1. To be honest I have never tried that but it should work (but no guarantees because I have never tried that).


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.