Returning Fields in the Record Object
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.
Return Specific Object Fields
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.
returns
a Record object that looks like
this:
<apex:canvasApp applicationName="MyApp" entityFields="Phone,Fax,BillingCity" containerId="canvasAppDiv"/>
"record":{
"attributes":{
"type":"Account",
"url":"/services/data/v63.0/sobjects/Account/001xx000003DGWiAAO"
},
"Id":"001xx000003DGWiAAO",
"Phone":"(555) 555-5555",
"Fax":"(555) 555-5555",
"BillingCity":"Seattle"
}
Return All Object Fields
You can return all object fields in the Record object by setting the entityFields attribute to the wildcard
"*".
returns
a Record object that looks like
this:
<apex:canvasApp applicationName="MyApp" entityFields="*" containerId="canvasAppDiv"/>
"record":{
"attributes":{
"type":"Account",
"url":"/services/data/v63.0/sobjects/Account/001xx000003DGWiAAO"
},
"Id":"001xx000003DGWiAAO",
"IsDeleted":false,
"MasterRecordId":null,
"Name":"Edge Communications",
"Type":"Customer - Channel",
"ParentId":null,
"BillingStreet":"123 Main Street",
"BillingCity":"Seattle",
"BillingState":"WA",
"BillingPostalCode":"98121",
"BillingCountry":"USA",
...
}
Return the Id Field
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.
returns
a Record object that looks like
this:
<apex:canvasApp applicationName="MyApp" containerId="canvasAppDiv"/>
"record":{
"attributes":{
"type":"Account",
"url":"/services/data/v63.0/sobjects/Account/001xx000003DGWiAAO"
},
"Id":"001xx000003DGWiAAO"
}