No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Newer Version Available
Force.com Canvas SDK Publisher Events
When you expose a canvas app in the publisher, you can
use well-defined events to enable communication between the canvas
app and the publisher.
Your canvas app can subscribe and publish these events to more tightly integrate with the publisher framework. For example, you can activate the standard Chatter Share button to post a Chatter feed item. You can also access the post text that the user enters in the What are you working on? field in the publisher and combine that with content from your app.
| Field | Description |
|---|---|
| publisher.clearPanelState | Fired by the publisher when the canvas app is deactivated or hidden. This can happen when the user selects a different application in the publisher or after the Share button has been clicked. A Visualforce page can also listen for this event. |
| publisher.failure | Fired by the publisher when an error condition is encountered
such as when invalid data has been submitted. For example:
The canvas app should listen for this event and alert the user that an error occurred and the post didn’t get created. |
| publisher.getPayload | Fired by the publisher when the Share button is clicked. The payload contains information such as the text entered into the What are you working on? field and who the feed item is being shared with. |
| publisher.setupPanel | Fired by the publisher when the Chatter feed page is initially loaded. |
| publisher.setPayload | Fired by the canvas app to indicate to the publisher that the
content being sent to the publisher should be shared in the feed item.
This event is in response to publisher.getPayload and contains information about the feed item you’re trying
to create. You can create three feed item types:
|
| publisher.setValidForSubmit | Fired by the canvas app to indicate to the publisher that the
canvas app is ready to submit a payload. After this event fires, the
Share button becomes active. This code snippet enables the Share
button:
|
| publisher.showPanel | Fired by the publisher when the user selects a canvas app in the publisher. This event indicates that the canvas app is being displayed. A Visualforce page can also listen for this event. |
| publisher.success | Fired by the publisher after the Share button is clicked and data is successfully submitted. |
Sequence of Publisher Events
Here’s
the order of publisher events from the perspective of the canvas app:
- The canvas app listens for publisher.setupPanel.
- The canvas app listens for publisher.showPanel.
- The user interacts with the canvas app, for example, clicks a button or enters some text. The canvas app does any validation required and then fires publisher.setValidForSubmit. As a result, the publisher then enables the Share button.
- The canvas app listens for publisher.getPayload.
- The canvas app fires publisher.setPayload.
- The canvas app listens for publisher.success.
- The canvas app listens for publisher.failure.
- The canvas app listens for publisher.clearPanelState.