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)

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

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