ComponentPluginV2


Packaged interface

Namespace: overcast

Extends ComponentPlugin

The ComponentPluginV2 interface provides a way for Overcast Components to execute custom code.

See the Overcast Component Plugin Template for the full implementation example.

The class and method visibility must be global so the Overcast managed package can call it.

Methods


 

afterComponentMetadataLoaded(recordId, cmp)

Executed after the component metadata is loaded from the database and before the UI is displayed to the user, and before the callScenario() method is called. Allows modification at runtime of the component definition before the component metadata data is used in these locations.

The method visibility must be global.

Signature

void afterComponentMetadataLoaded(Id recordId, ComponentDefinition.Component cmp)

Parameters

recordId

Type: Id

The ID of the record for the page the component is executing on. For example, if the component is on an Account detail screen, recordId will be the ID of the Account the user has on screen.

cmp

Type: overcast.ComponentDefinition.Component

The definition of the component. Changes to cmp will be reflected in the UI displayed to the user.

Return Value

Type: void


 

afterReferenceValuesLoaded(recordId, componentName, referenceValues)

Executed after the reference values are loaded from the database and before the UI is displayed to the user, and before the callScenario() method is called. Allows modification at runtime of the data loaded from referenced records before the data is used.
Reference values are data from fields that are configured in the Component Builder under the Reference Values and Parameter Mappings tabs.

This method is called in addition to ComponentPluginV3.afterReferenceValuesLoaded(recordId, componentName, referenceValues, referenceChildValues) so only one should have an implementation.

The method visibility must be global.

Signature

void afterReferenceValuesLoaded(Id recordId, String componentName, Map<String, Map<String, Object>> referenceValues)

Parameters

recordId

Type: Id

The ID of the record for the page the component is executing on. For example, if the component is on an Account detail screen, recordId will be the ID of the Account the user has on screen.

componentName

Type: String

The name of the currently executing component.

referenceValues

Type: Map<String, Map<String, Object>>

A collection of all the reference values that have been loaded from the database from the configured parameter mappings. The structure corresponds to that specified in the component definition, which is the same structure as returnedData in afterScenarioCall().

Usage

referenceValues keys are the section names defined in the component, and the value to each key is a map of all fields and their respective values. The values are loaded from database records or static values according to the parameter mappings configuration on the component.

Return Value

Type: void


 

onScenarioException(ex, retData)

Executed when calling the backend system results in an exception. This allows conditional logging and reporting to the user when an exception occurs when running a scenario. Any intentional exceptions thrown by the plugin class (overcast.ComponentFrameworkUtility.ComponentPluginException) or by the framework (overcast.ComponentFrameworkUtility.ComponentFrameworkException) will not be handled by this method.

The same instance of this class is used to call beforeScenarioCall(), afterScenarioCall(), and onScenarioException() so state can be maintained between calls in class properties.

The method visibility must be global.

Signature

Boolean onScenarioException(Exception ex, Map<String, Object> retData)

Parameters

ex

Type: Exception

The exception that was thrown from running the Integration Scenario.

retData

Type: Map<String, Object>

The data that was returned from the backend, if any. It is possible to insert into retData custom response data to display to the user.

Return Value

Type: Boolean

True to log and display the exception message to the user. False to not log and not display the exception message to the user.