Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Excerpt

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 Block
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 Block
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.

...

On this page

...