Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Javascript for lookup

(0) ShareShare
ReportReport
Posted on by 1,942

Hi all,

In appointment entity i am trying to set regarding field (party list type) to look for only user record instead of other entities. Based on the user selected in the party list, i have update the activity record owner to it.

How do i do this using JS?

Please advise

*This post is locked for comments

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Javascript for lookup

    If it does not work with the filer, I am guessing you might add a custom field(a look-up to the user entity),hide regarding on the form, and use that new field instead.. just make sure you also have a javascript, a workflow, or a plugin, to copy that new look-up selection to the regarding field.

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Javascript for lookup

    Hi,

    I am not sure that the addPreSearch solution will work for the case that you are looking for.

    The presearch allows filtering when you know what you are looking for within the entity.

    Xrm.Page.getControl("contactid").addPreSearch(function () {

        addContactLookupFilter();

    });

    function addContactLookupFilter()

    {

       var fetchXml = "<filter type='and'><condition attribute='lastname' operator='eq' value='james' /></filter>";

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

    }

    In this particular case you want to restrict the values to only one entity.

    It is possible that if you have a field in the contact entity that is unique to this, you might be able to achieve it with the addPreSearch. Worth a test.

    Try it out...

  • Suggested answer
    PranavShroti Profile Picture
    PranavShroti 4,510 on at

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,476 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans