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:


  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).


      1. Hi Andrew,

        Everthing is working fine but the property showNew: false is not hiding the +New Record button on lookup form.
        Can you please help me with the solution.


    1. Hello Yadnyesh,
      Methods related to custom filters are not listed as supported so can be considered as unsupported. That explains why methods are not available in the UCI interface.

    1. Bryan,
      I believe this is because “context” information is not passed inside lookup window that was opened.

    1. Hello Meva,
      Unfortunately I don’t know any supported way of doing it.

  2. Hi ,
    I am trying to use customViews with lookupOptions in new UCI but soemhow it is not working for me.
    Note: I am trying to use this on Associate Record button.
    I am probably missing something.
    Did you tries this with any of your lookupobject

  3. Hi Andrew,

    Can we Disable or Hide “New” button which is visible in that Quick create/popup with supported or unsupported way ?
    I tried with this line of code inside the function that is opening the custom lookup:
    $(‘#lookupDialogRoot’, window.parent.document).find(“ul”).css(‘display’, ‘none’);
    But doesn’t work.


        1. Amine,
          I believe it could be implemented in some way but I don’t know it and I don’t recommend using it.

  4. Hi. Custom view is working for me. how can we make display only custom view not all other views along with it?

  5. I tried to use a custom view with that code but the only thing that i have is undefined, theres is a way to use this component with a filter that needs the related entity ?

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.