locked
javascript function for prefiltering partylist views RRS feed

  • Question

  • Hi,

    I am trying to add a pre filter to a party list view where 'systemuser' entity's attribute 'ispublic' equals 'yes' for an email activity.

    For both 'to' and 'from' views. This is what I've written a function but its working only for 'to' and not working for 'from'.

    Obviously I made changes accordingly with the schema names for 'from' but same function. And called them on Form load.

    What am I doing wrong?

    function preFilterLookup() {    
     
    Xrm.Page.getControl("to").addPreSearch(function () {
     
        addLookupFilter();
     
      });
     
    }
     
    function addLookupFilter() {
     
     fetchXml = "<filter type='and'><condition attribute='new_ispublic' operator='eq' uitype='systemuser' value='Yes'/></filter>";
     document.getElementById("to_i").setAttribute("defaulttype", "8");
        document.getElementById("to_i").setAttribute("lookuptypes", "8");
        document.getElementById("to_i").setAttribute("lookuptypeIcons", "/_imgs/ico_16_8.gif");
    document.getElementById("to_i").disableViewPicker = 1;
     Xrm.Page.getControl("to").addCustomFilter(fetchXml);
     
    }

    Thanks
    Monday, September 15, 2014 8:07 PM

All replies

  • Create another function addLookupFilterFrom and instead of to field use from.

    Please note this code is not supported by Microsoft therefore you need to change your code.


    Regards Faisal

    Wednesday, September 17, 2014 11:18 AM