Newer Version Available
Context
When you add your canvas app as a connected app in Salesforce, you can
retrieve information about the current environment by using the Context object. The Context object provides information to your app
about how and by whom it’s being consumed. You can use this information to
make subsequent calls for information and code your app so that it appears
completely integrated with the Salesforce user
interface. This object is returned in JSON format and contains the following objects:
- Application—Information about the canvas app, such as version, access method, URL, and so on.
- Environment—Information about the environment, such as location, UI theme, and so on.
- Links—Links, such as the metadata URL, user URL, Chatter groups URL, and so on. You can use these links to make calls into Salesforce from your app.
- Organization—Information about the organization, such as name, ID, currency code, and so on.
- User—Information about the currently logged-in user, such as locale, name, user ID, email, and so on.
You can request Salesforce exclude portions of the context data that you don’t need. To control the amount of data that’s excluded, you must implement your own Canvas.CanvasLifecycleHandler in Apex and provide a list of excluded context sections in your implementation of excludeContextTypes().