Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Entity list - Search function happening before JavaScript

Posted on by Microsoft Employee

Hello, 

I have created an entity list and page template for my Dynamics Portal, this entity list also uses the search function. I am attempting to search for a full name with just the surname. This is returning a result of 0 contacts. I have attempted to resolve this by adding some JavaScript to add the '*' wildcard.

This method only works on the second attempt due to the search function happening before the javascript adds the wildcard to the search.

Is there a way to delay the search or start the JavaScript first?

Thank you,

Joe.

*This post is locked for comments

  • Suggested answer
    Dmytro Rutkovskyi Profile Picture
    Dmytro Rutkovskyi 1,835 on at
    RE: Entity list - Search function happening before JavaScript

    Hi, Can you specify your problem better?

    Here the several pieces of advice:

    1) If you doing something with entity list, you need wait until data is loaded, like:

    $(".entity-grid.entitylist").on("loaded", function () {
       //you code goes here
    });


    2) to apply search to the list - I think you can do it with metadata filters than you can use something like this to apply metadatafilter when enityt-list ready to update itslef:

    var entitygrid1 = $($("#entitylist1").find("div.entity-grid"));
    var entitygrid1_load = 0;
    $(document).ready(function(){
    
        entitygrid1.on("loaded", function () {
           entitygrid1_load ++;
            if (entitygrid1_load == 1)
            {
               $(this).trigger("metafilter",["0={{YOUR SEARCH STRING}}"]);
            }
       });
    });
    
    

    3) very obvious - just use some kind of timer to postpone search operation, like setTimeout(you_func_with_code_to_search, time_in_milliseonds);.

  • Jlavos Profile Picture
    Jlavos 345 on at
    RE: Entity list - Search function happening before JavaScript

    Hi, having the same issue, have you found a solution for this?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans