No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Newer Version Available
Context
When you add your canvas app as a connected app in Salesforce, you can retrieve information about the current environment by using
the Context object. The Context object provides information
to your app about how and by whom it’s being consumed. You
can use this information to make subsequent calls for information
and code your app so that it appears completely integrated with the Salesforce user interface. This object is returned in JSON format and contains
the following objects:
- Application—Information about the canvas app, such as version, access method, URL, and so on.
- Environment—Information about the environment, such as location, UI theme, and so on.
- Links—Links, such as the metadata URL, user URL, Chatter groups URL, and so on. You can use these links to make calls into Salesforce from your app.
- Organization—Information about the organization, such as name, ID, currency code, and so on.
- User—Information about the currently logged-in user, such as locale, name, user ID, email, and so on.
1"context":{
2 "application":
3 {
4 "applicationId":"06Px000000003ed",
5 "authType":"SIGNED_REQUEST",
6 "canvasUrl":"http://instance.salesforce.com:8080
7 /canvas_app_path/canvas_app.jsp",
8 "developerName":"my_java_app",
9 "name":"My Java App",
10 "namespace":"org_namespace",
11 "options":[],
12 "referenceId":"09HD00000000AUM",
13 "samlInitiationMethod": "None",
14 "version":"1.0.0"
15 },
16 "user":
17 {
18 "accessibilityModeEnabled":false,
19 "currencyISOCode":"USD",
20 "email":"admin@6457617734813492.com",
21 "firstName":"Sean",
22 "fullName":"Sean Forbes",
23 "isDefaultNetwork":false,
24 "language":"en_US",
25 "lastName":"Forbes",
26 "locale":"en_US",
27 "networkId":"0DBxx000000001r",
28 "profileId":"00ex0000000jzpt",
29 "profilePhotoUrl":"/profilephoto/005/F",
30 "profileThumbnailUrl":"/profilephoto/005/T",
31 "roleId":null,
32 "siteUrl":"https://mydomain.force.com/",
33 "siteUrlPrefix":"/mycommunity",
34 "timeZone":"America/Los_Angeles",
35 "userId":"005x0000001SyyEAAS",
36 "userName":"admin@6457617734813492.com",
37 "userType":"STANDARD"
38 },
39 "environment":
40 {
41 "parameters":{},
42 "dimensions":
43 {
44 "clientHeight": "50px",
45 "clientWidth": "70px",
46 "height":"900px",
47 "width":"800px",
48 "maxHeight":"2000px",
49 "maxWidth":"1000px"
50
51 },
52 "record":
53 {
54 "attributes":
55 {
56 "type":"Account",
57 "url":"/services/data/v31.0/sobjects/Account/001xx000003DGWiAAO"
58 },
59 "Id":"001xx000003DGWiAAO",
60 "Phone":"(555) 555-5555",
61 "Fax":"(555) 555-5555",
62 "BillingCity":"Seattle"
63 },
64 "displayLocation":"Chatter",
65 "locationUrl":"http://instance.salesforce.com:8080/canvas_app_path",
66 "subLocation":null,
67 "uiTheme":"Theme3",
68 "version":
69 {
70 "api":"31.0",
71 "season":"SUMMER"
72 }
73 },
74 "organization":
75 {
76 "currencyIsoCode":"USD",
77 "multicurrencyEnabled":true,
78 "name":"Edge Communications",
79 "namespacePrefix":"org_namespace",
80 "organizationId":"00Dx00000001hxyEAA"
81 },
82 "links":
83 {
84 "chatterFeedItemsUrl":"/services/data/v31.0/chatter/feed-items",
85 "chatterFeedsUrl":"/services/data/v31.0/chatter/feeds",
86 "chatterGroupsUrl":"/services/data/v31.0/chatter/groups",
87 "chatterUsersUrl":"/services/data/v31.0/chatter/users",
88 "enterpriseUrl":"/services/Soap/c/31.0/00Dx00000001hxy",
89 "loginUrl":"http://login.salesforce.com",
90 "metadataUrl":"/services/Soap/m/31.0/00Dx00000001hxy",
91 "partnerUrl":"/services/Soap/u/31.0/00Dx00000001hxy",
92 "queryUrl":"/services/data/v31.0/query/",
93 "restUrl":"/services/data/v31.0/",
94 "recentItemsUrl":"/services/data/v31.0/recent/",
95 "searchUrl":"/services/data/v31.0/search/",
96 "sobjectUrl":"/services/data/v31.0/sobjects/",
97 "userUrl":"/005x0000001SyyEAAS"
98 }
99}You can request Salesforce exclude portions of the context data that you don’t need. To control the amount of data that’s excluded, you must implement your own Canvas.CanvasLifecycleHandler in Apex and provide a list of excluded context sections in your implementation of excludeContextTypes().