Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Working with Lightning Platform Canvas
- Include the console integration toolkit API in index.jsp.
- If your console has an allowlist for domains, add the domain of your canvas app to the allowlist.
- Call Sfdc.canvas.client.signedrequest() to store the
signed request needed by the console integration toolkit API. For example, if the Lightning Platform
Canvas method of authentication is a signed request, do the
following:
1Sfdc.canvas.client.signedrequest('<%=signedRequest%>')If the Lightning Platform 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 Lightning Platform Canvas Developer’s Guide:
1Sfdc.canvas.client.signedrequest(msg)
- 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 the Lightning Platform Canvas Developer’s Guide.