Skip to main content
Skip table of contents

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

CODE
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 GoMeddo from trying to add a record to the list
        );
        return resultCollection;
    }
}

Example Result

Methods

getSearchResults

CODE
B25.SearchResultCollection getSearchResults(B25.SearchContext context)

This method must be overridden in your own classses.

Return value: B25.SearchResultCollection

Parameters:

Name

Type

Description

context

B25.SearchContext

The context contains more information about the search being performed.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.