locked
Customer Lookup Prefilter - D365 RRS feed

  • Question

  • Hi All,

    I am looking for some suggestion for the scenario below.

    I am using customer lookup field on my custom entity and created 1:N relationship with incident entity. Now, the question is to filter the customer lookup on the incident record based on the custom entity results. 

    Please let me know if we can achieve this using fetchxml or other way to show only the filter results instead of all results.

    Thanks!.


    SAFI

    Tuesday, December 19, 2017 8:26 AM

All replies

  • You can query the WEBAPI to get your results. Based on the results you can create a fetchxml and add this to the lookup.

    Xrm.Page.getControl("xxx_subregionid").addCustomFilter(fetchXml);

    The function which does all this work can be triggered by adding a PreSearch to the lookup.

    Xrm.Page.getControl("xxx_subregionid").addPreSearch(filterSubRegionsForCountry);

    When you press the lookup the function filterSubRegionsForCountry will be executed in this example.

    Wednesday, December 20, 2017 1:44 PM