PreSearch Event in Microsoft Dynamics 365

PreSearch event for updated entities

The new PreSearch event occurs just before the search dialog box opens when you set a lookup value. This event does not have user interface to set an event handler in the application; it can only be set using the Xrm.Page.ui control.addPreSearch method. Use this event with the addCustomFilter, addCustomView and setDefaultView methods to control the views opened when people search for a record to set as the value of a lookup field.

Use this method to apply changes to lookups based on values current just as the user is about to view results for the lookup.

Xrm.Page.getControl(arg).addPreSearch(handler)
Arguments
Type: Function to add.

Remarks
This method is only available for Updated entities.

The argument is a function that will be run just before the search to provide results for a lookup occurs. You can use this handler to call one of the other lookup control functions and improve the results to be displayed in the lookup.

 

Use this method to remove event handler functions that have previously been set for the PreSearch event.

Xrm.Page.getControl(arg).removePreSearch(handler)
Arguments
Type: Function to remove.

Remarks
This method is only available for Updated entities.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s