Skip to main content

Notifications

Announcements

No record found.

Service | Customer Service, Contact Center, Fie...
Unanswered

How to get control of the lookup modal jQuery

Posted on by 195

Hi,

Want to get control of the look up modal and the body using JQuery.

Please help me with this!!!

pastedimage1594393584612v1.png

Regards,

Susritha.

  • LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: How to get control of the lookup modal jQuery

    Hi Partner,

    You could get it in your own environment by Jquery code and find more details.

    In my case, there are 3 girds in my form so I will found 3 elements by $("table[role$='grid']") ), that is the reason we need to find the gird under the special DIV.

    pastedimage1594693512030v1.png

    After you get the table element, you could add tr and td in it to add your custom records.

    Regards,

    Leo

  • Susritha Profile Picture
    Susritha 195 on at
    RE: How to get control of the lookup modal jQuery

    Can you give more details  about $("table[role$='grid']") ) under its Div.

  • LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: How to get control of the lookup modal jQuery

    Hi partner,

    Thanks for your details.

    The modal in portal form could be found by $("table[role$='grid']") under its Div.

    pastedimage1594629184549v1.png

    pastedimage1594629209338v2.png

    And then you need to add your custom data into the table by its format.

    pastedimage1594629259665v3.png

    Best Regards,

    Leo

  • Susritha Profile Picture
    Susritha 195 on at
    RE: How to get control of the lookup modal jQuery

    The required is to add records to the lookup modal based on the odata Query.

    When I was trying with the Custom modal then I can able to get control of it and I can add records to the modal.

    $('#myModal').find('.modal-body .table tbody').append('<tr data-id="' + data.value[i].knowledgearticleid + '" data-entity="knowledgearticle" data-name="' + data.value[i].title + '><td data-th="Select" aria-label="Select " tabindex="0" role="checkbox"> <span class="fa fa-fw"></span></td><td data-type="System.String" data-attribute="title" data-value="' + data.value[i].title + '" tabindex = "0" data-th="Title" aria-label="' + data.value[i].title + '" > ' + data.value[i].title + '</td ></tr>');

    pastedimage1594610864047v1.png

    but not for the lookup modal in Entity form.

    Please help me with this!!!

  • LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: How to get control of the lookup modal jQuery

    Hi Partner,

    Could you kindly share more details about your requirement, why you need to get the lookup field by Jquery when opening the modal?

    As we know we need to use $("#fieldname) to get field in portal form, and even though you opened the lookup modal, you could also get the lookup filed by this code.

    pastedimage1594603971985v1.png

    And if you want to do actions on the lookup modal, you could find its ID or  class name by F12 developer tools.

    pastedimage1594604030879v2.png

    Best Regards,

    Leo

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans