web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Filter Lookup Field on Editable Grid by script

(0) ShareShare
ReportReport
Posted on by

Hi Folks

Just have an inquiry regarding to filtering lookup field on editable grid. Is it possible to use sort of addCustomView js functionality to filter data by creating custom view based on our own fetchXML? I know that we can utilise the pre-built lookup filtering functionality on editable grid which is already provided by D365 standard configuration, but that requires the field that needs to be used for filtering to be available on the view which is not favored by our client. Any hint would be very much appreciated. Many thanks in advance.

editableGridLookupFilter.png


Regards,
Jonas

D365 CE v9.0.20.7 UCI on-premise

I have the same question (0)
  • Suggested answer
    MehranBre Profile Picture
    732 on at

    hi,

    Did you try the Add Lookup option in the Controls tab, Editable View (in Form Editor)?

    This option allows you to filter the lock-up based on the fields on the form.

    good luck.

  • Community Member Profile Picture
    on at

    Hi mate

    Thanks for the response. I did try that, but there is no option to filter lookup based on the fields on the form, the available option is to filter lookup on the view based on the field on the view itself. Is there any special configuration to make it available to be filtered by the field on the form? We thought of using a script, but could not find such available api event yet to do so on the editable grid. Thanks.

    Regards,

    Jonas

  • Verified answer
    MehranBre Profile Picture
    732 on at

    hello,

    I think you left something out
    The image below is the Add Lookup form on the editable grid
    In the Contains section, you can choose which field of the related records you selected above will be filtered, which is certainly one of the related records of the same entity in which you are in its form.

    0243.Untitled.png

  • Community Member Profile Picture
    on at

    Hi mate

    Yes, that's the one that we use to filter using pre-built feature by selecting available fields on the view. However, there is no way found yet to filter based on fields on the form which is non-existent on the view.

    Regards,

    Jonas

  • Community Member Profile Picture
    on at

    It was found that the customer data on the grid view is still empty, hence we can use this feature when we fill the field to filter on background process for the custom entity. Thanks, mate!

  • Suggested answer
    MehranBre Profile Picture
    732 on at

    I still think that could be the solution for you!


    OK. You can also use JavaScript to do this. Call the following function for the OnRecordSelect editable grid event. Also check "Pass execution context as first parameter".
    In this function, you have access to all the fields on the editable grid, and you can filter the lock-up fields here as well as filtering a lock-up on the form.

    function onSelectSubGrid(context) {
    
        var subGrid = context.getFormContext().data.entity;
    
        subGrid.attributes.forEach(function (field, i) {
            field.controls.get(0).setDisabled(true);
        });
    }

  • Community Member Profile Picture
    on at

    Hi Mehran

    Thanks for sharing those, although we just found out that the pre-built lookup field on editable grid in on-premise version that we tried yesterday is somehow malfunctioning. It does not always work, so I suppose that it is why we are still looking for some other way in the first place since it is something that we need to report to MS Support further. Anyhow, thanks, though!

    Regards,

    Jonas

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 56 Super User 2026 Season 1

#2
Eugen Podkorytov Profile Picture

Eugen Podkorytov 49

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 31 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans