Dynamics CRM: Adding a filter to the lookup

By | April 13, 2016

Here is a short code sample on how to add a pre-search filter to the lookup

function onLoad()
{
Xrm.Page.getControl(…).addPreSearch(function () { addPreSearchFilter(); });
}

function addPreSearchFilter()
{

var filter = “<filter type=’and’>” +
“<condition attribute=’…’ operator=’not-null’/>” +
“</filter>”;

Xrm.Page.getControl(…).addCustomFilter(filter);
}

Leave a Reply

Your email address will not be published. Required fields are marked *