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.
Visualforce Page Code Examples
Object Detail Page
The following code snippet is an example of how to display a canvas app on an Account page. The code specifies the size of the canvas app to be 400 pixels high and 750 pixels wide. This examples specifies the canvas app using the applicationName and namespacePrefix.
1<apex:page standardController="Account">
2
3 <apex:canvasApp applicationName="Test Inline Visualforce"
4 namespacePrefix="testorg"
5 height="400px" width="750px"/>
6</apex:page>Standard Page
The following code snippet is an example of how to display a canvas app on a Visualforce page. The code specifies the size of the canvas app to be 1,000 pixels high and 800 pixels wide. In addition, the code passes three custom parameters to the canvas app. This examples specifies the canvas app using the developerName and namespacePrefix.
1<apex:page>
2
3 <apex:canvasApp developerName="Test_Standard_Visualforce"
4 namespacePrefix="testorg" height="1000px" width="800px"
5 parameters='{"p1":"value1", "p2":"value2", "p3":"value3"}'/>
6
7</apex:page>Standard Page with a Border and Scrolling
The following code snippet is an example of how to display a canvas app with some additional UI enhancements on a Visualforce page. The code specifies the size of the canvas app to be 100 pixels high and 500 pixels wide. In addition, the code specifies that there should be a border of 2 pixels around the canvas app and that scrolling should be enabled. This examples specifies the canvas app using only the applicationName (this is only valid in the organization in which the canvas app was created, and if that organization doesn’t have a namespacePrefix.
1<apex:page>
2
3 <apex:canvasApp applicationName="Test Scrolling Visualforce"
4 height="100px" width="500px"
5 border="2" scrolling="yes"/>
6
7</apex:page>