locked
CRM 2015 - Custom Activity addCustomFilter seems to be ignored RRS feed

  • Question

  • I have a custom activity with a "from" field.

    By default will show Accounts when the magnifying glass is clicked. I have written some code (based on the SDK, which should set the default entity to Contact.  However it is ignored.

    I have used the IE developer tools to establish that the code is hit when the magnifying glass is clicked.

    The code is:

    function filterCustomers() {
        var customerFilter = "<filter type='and'><condition attribute='statecode' operator='eq' value='0'/></filter>";
        Xrm.Page.getControl("from").addCustomFilter(customerFilter , "contact");
    }
    
    function onLoad() {
    
        Xrm.Page.getControl("from").addPreSearch(filterCustomers); 
    
    }
    

    I don't actually need to filter the records, just force the drop down to Contact.  I have put it in to closer match the SDK example.

    Any ideas why this doesn't work?

    Tuesday, October 27, 2015 5:09 PM