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)

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

I have the same question (0)
  • Verified answer
    Kalpavruksh D365 CoE Profile Picture
    2,545 on at

    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.

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    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.

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 April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans