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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Look up field filter

(0) ShareShare
ReportReport
Posted on by 40

I have a search field on the form and when you click on look up more records a look up records window opens up. in the look for tab i want to apply a filter where users only see a single option. How can i do that??

 Please suggest asap 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mahadeo Matre Profile Picture
    17,021 on at

    Hi,

    You need set View selector = off in lookup fields property and select required view.

    community.dynamics.com/.../how-to-filter-lookups-by-related-records-in-dynamics-365

    If you need to add some more fillers than existing system view filters, then you need to add custom filter to lookup.

    www.inogic.com/.../apply-custom-filter-on-lookup-field-in-dynamic-crm-using-script

    dynamicsforbusiness.blogspot.com/.../dynamics-crm-native-lookup-with-filtered-view.html

    community.dynamics.com/.../more-adventures-in-pre-filtering-customer-lookup-fields-dynamics-crm-dynamics-365-for-enterprise

    hope this will help ..

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi Shashank,

    To make it clear , In the lookup More options there is three options-

    1 - Look For

        This is for entities which are associated with the lookup. Let say if you are clicking on more records for customer lookup you will see two options Contacts and Account as customer lookup is multi entity lookup. You can not change this behavior , for that you need to create single entity lookup. 

    2- Look In

       Display the views which has been set in the lookup field properties.    

    There is two options when you go to lookup field properties by double click on lookup field - 

    - Default View 

        You need to select which view you want to display, you can apply filter criteria for that view to show the record.

     - View Selector 

        Make sure you choose "Off" so that except the Default view , none of the views will show in the look in criteria.

    7444.view-Selector.png

    3- Search

       You can search by field value .

    On top of above filter criteria(Mainly point 2 ) you need to add custom filter using  JavaScript  in the form load where the actual data filter will be apply. 

            function OnloadForm()
            {          
                Xrm.Page.getControl("nfs_project").addPreSearch(addFilter); // Replace the lookup field name 
            }
            function addFilter()
            {
                var filter = "<filter type='and'><condition attribute='msdyn_istemplate' operator='eq' value='1' /></filter>"; // Add condition like this
                Xrm.Page.getControl("nfs_project").addCustomFilter(filter);  //Replace the filed name
            }


    Hope this helps.

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    The simple (no code) way is to create a view which returns only the record you want to show and then under the lookup properties, select that view as the default view and set the view filter to Off.

    Hope this helps.

  • Shashank961 Profile Picture
    40 on at

    it is a managed form so i cannot apply filters. I need to use JS i think

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Did you try changing the field properties as suggested. Managed doesn't always means that you can't customize it, it depends upon the managed properties. I would suggest to try the above suggest and share the outcome.

    Hope this help

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans