excludeContextTypes()

Lets the implementation exclude parts of the CanvasRequest context, if the application does not need it.

Signature

public Set<Canvas.ContextTypeEnum> excludeContextTypes()

Return Value

Type: SET<Canvas.ContextTypeEnum>

This method must return null or a set of zero or more ContextTypeEnum values. Returning null enables all attributes by default. ContextTypeEnum values that can be set are:
  • Canvas.ContextTypeEnum.ORGANIZATION
  • Canvas.ContextTypeEnum.RECORD_DETAIL
  • Canvas.ContextTypeEnum.USER
See ContextTypeEnum for more details on these values.

Usage

Implement this method to specify which attributes to disable in the context of the canvas app. A disabled attribute will set the associated canvas context information to null.

Disabling attributes can help improve performance by reducing the size of the signed request and canvas context. Also, disabled attributes do not need to be retrieved by Salesforce, which further improves performance.

See the Force.com Canvas Developer’s Guide for more information on context information in the Context object that’s provided in the CanvasRequest.

Example

This example implementation specifies that the organization information will be disabled in the canvas context.

public Set<Canvas.ContextTypeEnum> excludeContextTypes() {
    Set<Canvas.ContextTypeEnum> excluded = new Set<Canvas.ContextTypeEnum>();
    excluded.add(Canvas.ContextTypeEnum.ORGANIZATION);
    return excluded;
}
Previous
Next