Newer Version Available
Creating a CanvasLifecycleHandler
You can control your app lifecycle by providing an implementation of the
Canvas.CanvasLifecycleHandler Apex interface that Salesforce can use.
The Apex Canvas.CanvasLifecycleHandler interface provides methods and callbacks for customizing app lifecycle behavior. Salesforce will use your implementation at runtime to let you run custom code. Use the following steps to create an implementation of the Canvas.CanvasLifecycleHandler interface.
- From Setup, enter Apex Classes in the Quick Find box, then select Apex Classes.
- Click New to create a Apex class.
-
Create an Apex class that implements the Canvas.CanvasLifecycleHandler
interface. You must implement the excludeContextTypes() and onRender() methods. Here’s a template example:
- After you’ve finished adding your code, save the Apex class.
- Optionally test your implementation by using the Canvas.Test class.
- To let Salesforce know which implementation to use for your app, associate your Apex class with your app.