B25.SearchHandler

Overview

Extend this class to create your own handlers that react to searches on the form, allowing you to customize the results.

To customize search results, first create your own class which extends B25.SearchHandler. Then, inside the customize method (as defined in the B25.Form.Customizer interface), you can bind an instance of your class to an lookup or list search box on the form.

To extend this class, you must override the getSearchResults method. Inside the getSearchResults method you can then add your own logic to customize the results.

Example

1 2 3 4 5 6 7 8 9 10 global with sharing class MySearchHandler extends B25.SearchHandler { global override B25.SearchResultCollection getSearchResults(B25.SearchContext context) { B25.SearchResultCollection resultCollection = new B25.SearchResultCollection(); resultCollection.addSearchResult( new B25.SearchResult('hello-world', 'Hello World!') .setPreventDefault(true) // this line prevents Booker25 from trying to add a record to the list ); return resultCollection; } }

Example Result

 

Methods

getSearchResults

1 B25.SearchResultCollection getSearchResults(B25.SearchContext context)

This method must be overridden in your own classses.

Return value: https://gen25-jira.atlassian.net/wiki/spaces/BPD/pages/1970307096

Parameters:

Name

Type

Description

context

B25.SearchContext

The context contains more information about the search being performed.