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

Announcements

No record found.

News and Announcements icon
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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
AS-17030037-0 Profile Picture

AS-17030037-0 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans