addPreSearch and addCustomFilter in CRM 2013

Using these new methods we can now easily filter the lookup in CRM 2013.

Using addPreSearch we can specify a handler to PreSearch Event. Inside the handler we can specify our fetch xml query that can be used for filtering. The filter applied in the fetch xml will be combined with the any previously added filter as an 'AND' condition.

To remove the filter we can use removePreSearch method.

Here we are filtering the primary contact lookup to show only those records starting with S in the account form.

Account Form Load:-

The filter applies to all the Views.

Active Contacts View


Contacts: No Campaign Activities in Last 3 Month View


Shraddha Dhingra