Versions Compared

Key

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

Overview

Excerpt

This class represents one result shown to the user when they search in a lookup or a list.

Your search handlers are expected to return SearchResults bundled together in a B25.SearchResultCollection instance. You can either create your own collection, or get one using B25.SearchContext.getDefaultResults().

Example

Code Block
global with sharing class MySearchResults extends B25.SearchHandler {
    global override B25.SearchResultCollection getSearchResults(B25.SearchContext context) {
        B25.SearchResultCollection collection = new B25.SearchResultCollection();
        collection.addSearchResult(new B25.SearchResult('some-identifier', 'Hello World!'));
        return collection;
    }
}

Inner Classes

B25.SearchResult.Collection

...

Use this class to bundle together multiple instances of B25.SearchResult. This is what is expected to be returned by B25.SearchContext.SearchHandler.

addResult

...

Example Result

...

Methods

setSelectable

Code Block
B25.SearchResult 

...

setSelectable(Boolean selectable)

Adds the given search result to this collection.

Parameters:

Name

Type

Description

searchResult

B25.SearchResult

The search result you want to add.

addResults

Code Block
void addSearchResults(List<B25.SearchResult> searchResults)

...

Sets the ‘selectable’ property for this result. A result that is not selectable can’t be selected by the user. This is useful for displaying information to the user. The default value is true.

Return value: B25.SearchResult

Parameters:

Name

Type

Description

...

selectable

...

List<B25.SearchResult>

...

The list of search results you want to add.

getResults

Code Block
List<B25.SearchResult> getResults()

Returns the individual results inside this collection.

Return value: List<B25.SearchResult>

Methods

setSelectable

Code Block
B25.SearchResult setSelectable(Boolean selectable)

...

Boolean

The value for the ‘selectable’ property.

...

getSelectable

Code Block
Boolean getSelectable()

Gets the ‘selectable’ property for this result. A result that is not selectable can’t be selected by the user. This is useful for displaying information to the user. The default value is true.

Return value:

...

Parameters:

...

Name

...

Type

...

Description

...

selectable

Boolean

...

The value for the ‘selectable’ property.

...

setPreventDefault

Code Block
B25.SearchResult setPreventDefault(Boolean preventDefault)

Sets the ‘prevent default’ property for this result. A result that has ‘prevent default’ enabled, will not be added to the list when selected. This is useful for showing options which should trigger custom logic instead of adding a record. The default value is false.

Return value: B25.SearchResult

Parameters:

Name

Type

Description

preventDefault

Boolean

The value for the ‘prevent default’ property.

...

getPreventDefault

Code Block
Boolean getPreventDefault()

Gets the ‘prevent default’ property for this result. A result that has ‘prevent default’ enabled, will not be added to the list when selected. This is useful for showing options which should trigger custom logic instead of adding a record. The default value is false.

Return value: Boolean

...

setIcon

Code Block
B25.SearchResult setIcon(String iconName)

Sets this result’s icon. You can use icons from this page: https://www.lightningdesignsystem.com/icons/ , except for the icons in the Action category. Reference icons by combining the category and the icon name, with a colon in between. For example, 'standard:contact' will give you the contact icon from the Standard category.

Return value: B25.SearchResult

Parameters:

Name

Type

Description

iconName

String

The name of the icon.

...

getIcon

Code Block
String getIcon()

Gets this result’s icon.

Return value: String

...

setMetaText

Code Block
B25.SearchResult setMetaText(String metaText)

This method sets the meta text for the result.

Return value: B25.SearchResult

Parameters:

Name

Type

Description

metaText

String

The text that you want to set

...

On this page

...

.

...

getMetaText

Code Block
String getMetaText()

This method gets the meta text for the result.

Return value: String

...

getId

Code Block
String getId()

This method gets the Id for the result.

Return value: String

...

getLabel

Code Block
String getLabel()

This method gets the label for the result.

Return value: String