Monday 30 June 2014

CRM 2011/2013 Filter ‘Look For’ Lookup View Entity Field Activity Party

Code:

function preFilterLookup() {    

Xrm.Page.getControl("to").addPreSearch(function () {

    addLookupFilter();

  });

}

function addLookupFilter() {

//to lock only for System User
 fetchXml = "<filter type='and'><condition attribute='isdisabled' operator='eq' uitype='systemuser' value='0' /></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);

}

 Result:
image

image

Hope it helps!

3 comments:

  1. Hi there,
    It doesn't seem to work for required/optional attendees on the appointment form, sadly :(
    Sander

    ReplyDelete
  2. FetchXML you can here online http://msxrmtools.com

    ReplyDelete
  3. Thanks for the information and links you shared this is so should be a useful and quite informative!
    Filter Operator

    ReplyDelete

My Name is..