Newer Version Available

This content describes an older version of this product. View Latest

Environment

The Environment object is a JSON-formatted object containing context information about the canvas app environment. This object contains the Dimensions object, the Record object, the Version object, and parameters (if there are any) in the Parameters object.

Field Description
displayLocation The location in the application where the canvas app is currently being called from. Valid values are:
  • Chatter—The canvas app was called from the Chatter tab.
  • ChatterFeed—The canvas app was called from a Chatter canvas feed item.
  • MobileNav—The canvas app was called from the navigation menu in Salesforce1.
  • OpenCTI—The canvas app was called from an Open CTI component.
  • PageLayout—The canvas app was called from an element within a page layout. If the displayLocation is PageLayout, one of the subLocation values might be returned.
  • Publisher—The canvas app was called from a canvas custom quick action.
  • ServiceDesk—The canvas app was called from a Salesforce Console component.
  • Visualforce—The canvas app was called from a Visualforce page.
  • None—The canvas app was called from the Canvas App Previewer.
locationUrl The URL of the page in Salesforce where the user accesses the canvas app. For example, if users access your canvas app by clicking a link on the Chatter tab, this field contains the URL of the Chatter tab.
subLocation The sublocation in the application where the canvas app was called from when the canvas app is loaded in a mobile device. The subLocation is related to the displayLocation. Valid values for this field when the displayLocation is PageLayout are:
  • S1MobileCardFullview—The canvas app was called from a mobile card.
  • S1MobileCardPreview—The canvas app was called from a mobile card preview. The user must click the preview to open the app.
  • S1RecordHomePreview—The canvas app was called from a record detail page preview.  The user must click the preview to open the app.
  • S1RecordHomeFullview—The canvas app was called from a page layout.
uiTheme The default theme for the context organization.

The following code snippet shows an example of the Environment object.

1"environment": 
2{ 
3    "parameters":{},
4    "dimensions":
5    { 
6        "clientHeight": "50px", 
7        "clientWidth": "70px", 
8        "height":"900px", 
9        "width":"800px",
10        "maxHeight":"2000px", 
11        "maxWidth":"1000px"
12 
13    }, 
14    "record": {
15        "attributes": {
16            "type": "Account",
17            "url": "/services/data/v36.0/sobjects/Account/001xx000003DGWiAAO"
18        },
19            "Id": "001xx000003DGWiAAO",
20            "Phone": "(555) 555-5555",
21            "Fax": "(555) 555-5555",
22            "BillingCity": "Seattle"
23    },
24    "displayLocation":"PageLayout", 
25    "locationUrl":"http://www.salesforce.com/some/path/index.html", 
26    "subLocation":"S1MobileCardFullview",
27    "uiTheme":"Theme3",
28    "version":
29    { 
30        "api":"36.0", 
31        "season":"SUMMER" 
32     }
33}