Newer Version Available
Working with Force.com Canvas
To integrate the Salesforce Console with
external applications that require authentication methods, such as signed requests or OAuth 2.0
protocols, Salesforce recommends you use Force.com Canvas.
Force.com Canvas and the Salesforce Console Integration Toolkit are
similar—they’re a set of tools and JavaScript APIs that developers can use to add
third-party systems to Salesforce.
However, one of the benefits of Force.com Canvas, is the ability to choose
authentication methods. For more information, see the Force.com Canvas Developer’s
Guide.
When developing a canvas app, and you want to include functionality
from the Salesforce Console Integration Toolkit, do the following:
- Include the console integration toolkit API in index.jsp.
- If your console has a whitelist for domains, add the domain of your canvas app to the whitelist. See Whitelist Domains for a Salesforce Console.
- Call Sfdc.canvas.client.signedrequest() to store the signed request needed by the console integration toolkit
API. For example, if the Force.com Canvas method of authentication is a signed request, do the following:
1Sfdc.canvas.client.signedrequest('<%=signedRequest%>')If the Force.com Canvas method of authentication is OAuth, do the following in the callback function used to get the context as shown in “Getting Context in Your Canvas App” in the Force.com Canvas Developer’s Guide:
1Sfdc.canvas.client.signedrequest(msg)
Consider the following when working with the Salesforce Console Integration Toolkit and canvas apps:
- The console integration toolkit API script depends on the signed request and should be added after the call to Sfdc.canvas.client.signedrequest() has executed. We recommend that you load the scripts dynamically.
- To retrieve the entity ID of the record that is associated with
the canvas sidebar component, do the following:
1// Get signedRequest 2var signedRequest = Sfdc.canvas.client.signedrequest(); 3var parsedRequest = JSON.parse(signedRequest); 4// get the entity Id that is associated with this canvas sidebar component. 5var entityId = parsedRequest.context.environment.parameters.entityId; - To retrieve the entityId for OAuth, do the following:
1var entityId = msg.payload.environment.parameters.entityId;To see an example on how to retrieve msg.payload, see “Getting Context in Your Canvas App” in the Force.com Canvas Developer���s Guide.