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)

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

I have the same question (0)
  • Suggested answer
    PranavShroti Profile Picture
    4,510 on at

    You can refer below links:

    www.powerobjects.com/.../filtering-partylist-fields-with-javascript-addpresearch

    community.dynamics.com/.../186549

    Regards,

    Pranav

  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    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...

  • ashlega Profile Picture
    34,477 on at

    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.

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