Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

how precise is addPreSearch?

(0) ShareShare
ReportReport
Posted on by 1,030

can I actually feed it:

    "<link-entity name='productpricelevel' from='productid' to='productid' link-type='inner' alias='ab'>" +
      "<filter type='and'>" +
        "<condition attribute='pricelevelid' operator='in'>" +
          "<value uitype='pricelevel'>" + dfltPxLstId + "</value>" +
          "<value uitype='pricelevel'>" + MQpxLstId + "</value>" +
        "</condition>" +
      "</filter>" +
    "</link-entity>"

does it just insert/replace the text between <order /> and </entity>

thanks

*This post is locked for comments

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: how precise is addPreSearch?

    Hi,

    You can't use linked entity in the xml, it has to be direct filters to the main entity. refer below thread-

    community.dynamics.com/.../257676

    community.dynamics.com/.../137618

    stackoverflow.com/.../using-linked-entity-in-addcustomfilter

    Hope this helps.

  • Verified answer
    Kalpavruksh D365 CoE Profile Picture
    2,545 on at
    RE: how precise is addPreSearch?

    Hi,

    addPreSeach filter can't have a complex query like link-entity. You can add only entity level filtering attribute. 

    This is an example of addPreSearchFilter:

    function AddPreSearchToAccount(executionContext) {

    var formContext = executionContext.getFormContext();

       formContext .getControl("parentaccountid").addPreSearch(FilterLookup);

    }

    function FilterLookup(formContext ) {
    var formContext = executionContext.getFormContext();
       var fetchXML = "<filter type=\"and\">" +
                                 "<condition value=\"New York\" attribute=\"address1_city\" operator=\"eq\" />" +
                                 "</filter>";
     
      formContext.getControl("parentaccountid").addCustomFilter(fetchXML);
    }
     
    To add a complex query to filter the lookup kindly use a addCustomView

     

    Please mark as verified if the answer has helped you to resolve the issue, this will help other users in the community to resolve the same or similar issues.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans