Visualforce Page Code Examples
Visualforce Considerations
Returning Fields in the Record Object
Lightning Component Code Examples
Canvas Limits
Previous Versions
When you use the <apex:canvasApp> component to display a canvas app on a Visualforce page, and that page is associated with an object (placed on the page layout, for example), you can specify fields to be returned from the related object. To do this, use the entityFields attribute. You can use this attribute in one of the following ways.
You can return specific object fields in the Record object by setting the entityFields attribute to a comma-separated list of field names. If there’s an invalid field name in the list, then that field name is ignored and the valid fields are returned in the Record object.
1<apex:canvasApp applicationName="MyApp" entityFields="Phone,Fax,BillingCity" containerId="canvasAppDiv"/>returns a Record object that looks like this:
1"record":{
2 "attributes":{
3 "type":"Account",
4 "url":"/services/data/v68.0/sobjects/Account/001xx000003DGWiAAO"
5 },
6 "Id":"001xx000003DGWiAAO",
7 "Phone":"(555) 555-5555",
8 "Fax":"(555) 555-5555",
9 "BillingCity":"Seattle"
10 }You can return all object fields in the Record object by setting the entityFields attribute to the wildcard ”*”.
1<apex:canvasApp applicationName="MyApp" entityFields="*" containerId="canvasAppDiv"/>returns a Record object that looks like this:
1"record":{
2 "attributes":{
3 "type":"Account",
4 "url":"/services/data/v68.0/sobjects/Account/001xx000003DGWiAAO"
5 },
6 "Id":"001xx000003DGWiAAO",
7 "IsDeleted":false,
8 "MasterRecordId":null,
9 "Name":"Edge Communications",
10 "Type":"Customer - Channel",
11 "ParentId":null,
12 "BillingStreet":"123 Main Street",
13 "BillingCity":"Seattle",
14 "BillingState":"WA",
15 "BillingPostalCode":"98121",
16 "BillingCountry":"USA",
17...
18 }If the <apex:canvasApp> component doesn’t have the entityFields attribute or if the attribute is blank, then only the Id field is returned in the Record object.
1<apex:canvasApp applicationName="MyApp" containerId="canvasAppDiv"/>returns a Record object that looks like this:
1"record":{
2 "attributes":{
3 "type":"Account",
4 "url":"/services/data/v68.0/sobjects/Account/001xx000003DGWiAAO"
5 },
6 "Id":"001xx000003DGWiAAO"
7 }See Also