Customer Engagement & Dynamics CRM Forum

 View Only
  • 1.  Filtering Lookup on parentcustomerid on contacts

    Posted 28 days ago
    Hi,
    I have seen so many options for filtering the lookup on parentcustomerid field on contacts to only show account, but none seem to work for us.  Most of what I'm seeing is dated so I'm hoping to get something more current that people find successful.
    I have tried:
    - Setting a default view
    - addPreSearch
    - Updating the Quick Find View for Accounts
    Or if MS has made this possible to update, that would be great!
    Thank you in advance!

    ------------------------------
    Vanessa Lopez
    Black Knight Inc.
    Jacksonville FL
    ------------------------------


  • 2.  RE: Filtering Lookup on parentcustomerid on contacts

    Posted 23 days ago
    Still trying to resolve this issue, please help!

    ------------------------------
    Vanessa Lopez
    Black Knight Financial Services
    Jacksonville FL
    ------------------------------



  • 3.  RE: Filtering Lookup on parentcustomerid on contacts

    TOP CONTRIBUTOR
    Posted 22 days ago
      |   view attached

    Have you tried this?



    ------------------------------
    Gerry Yurko
    CRM Developer
    Crown Castle Fiber Networks
    Boxborough MA
    ------------------------------



  • 4.  RE: Filtering Lookup on parentcustomerid on contacts

    Posted 22 days ago
    That would work if it wasn't a managed field and I could update the lookup criteria.  Its not in the advanced find I'm having trouble, its the lookup on the field itself, I want to eliminate the ability to associate contacts to contacts.

    ------------------------------
    Vanessa Lopez
    Black Knight Financial Services
    Jacksonville FL
    ------------------------------



  • 5.  RE: Filtering Lookup on parentcustomerid on contacts

    TOP CONTRIBUTOR
    Posted 20 days ago
    Okay.  If you are familiar with JavaScript, you can add a PreSearch Filter to the Lookup Field. Just call the LimitCustomerLookup function on Load of the Form.

    function LimitCustomerLookup() {
       Xrm.Page.getControl("parentcustomerid").addPreSearch(AddFilter});
    }
     
    function AddFilter() {
       var customerAccountFilter = "<filter type='and'><condition attribute='contactid' operator='null' /></filter>";
       Xrm.Page.getControl("parentcustomerid").addCustomFilter(customerAccountFilter, "contact");
    }

    Users can still choose Contact from the Search, but no Contact Records will be found.  Eventually people will stop trying.

    This is "XRM.Page" Code but can easily be converted to FormContext.

    There were several WebSites that I found had the Solution using the search criteria "Microsoft CRM restrict Customer Lookup"

    ------------------------------
    Gerry Yurko
    CRM Developer
    Crown Castle Fiber Networks
    Boxborough MA
    ------------------------------



  • 6.  RE: Filtering Lookup on parentcustomerid on contacts

    SILVER CONTRIBUTOR
    Posted 17 days ago
    Hi Vaness

    Create a solution that only has the Contact form in it - (this is how you get around  Managed) -  only the form - no fields  - nothing else

    Then create a web resource script and add it to OnLoad  -  you will also need to tick the box to pass the ExectionContext

    -----------------------------------------------------------------------------

    function setCustomerAccount(executionContext)
    {
    var formContext = executionContext.getFormContext();

    formContext.getControl("parentcustomerid").setEntityTypes(["account"]);
    }

    ------------------------------------------------------------------

    If you still have trouble hit me up

    Pete

    ------------------------------
    Peter Hale
    Naish Pty Ltd
    ------------------------------



If you've found this thread useful, dive deeper into User Group community content by role