Canvas Developer Guide
Total Page:16
File Type:pdf, Size:1020Kb
Canvas Developer Guide Version 53.0, Winter ’22 @salesforcedocs Last updated: August 5, 2021 © Copyright 2000–2021 salesforce.com, inc. All rights reserved. Salesforce is a registered trademark of salesforce.com, inc., as are other names and marks. Other marks appearing herein may be trademarks of their respective owners. CONTENTS GETTING STARTED . 1 Chapter 1: Introducing Canvas . 1 Canvas Scenarios . 3 Where Canvas Apps Appear . 3 Supported Browsers . 4 Supported Salesforce Editions . 4 User Permissions Required . 5 User Interface Considerations . 5 Canvas App Process . 6 Canvas Personal Apps . 8 Canvas Personal App Process . 8 Enabling Canvas Personal Apps within an Organization . 9 Making an App a Canvas Personal App . 10 Uninstalling a Canvas Personal App . 10 Chapter 2: Quick Start . 12 Prerequisites . 13 Create the App . 13 Set the App Location . 14 Chapter 3: Quick Start—Advanced . 16 Prerequisites . 17 Clone the Project from GitHub . 17 Run the Web App Locally . 18 Create the Canvas App . 19 Configure Who Can Access the Canvas App . 21 Deploy the Web App to Heroku . 22 Update the Canvas App . 23 Package the Canvas App . 24 Upload the Canvas App Package . 25 Install the Canvas App . 25 Configure Who Can Access the Installed Canvas App . 26 USING CANVAS . 27 Chapter 4: Canvas SDK . 27 Referencing the Canvas SDK . 28 Authentication . 28 Signed Request Authentication . 28 Contents OAuth Authorization . 36 SAML Single Sign-On for Canvas Apps . 40 Getting Context in Your Canvas App . 40 Cross-Domain XHR . 41 Getting a List of Chatter Users . 41 Posting to a Chatter Feed . 42 Alternatives to Cookies for User Tracking . 42 Resizing a Canvas App . 43 Automatically Resizing a Canvas App . 44 Explicitly Resizing a Canvas App . 45 Getting the Size of a Canvas App . 45 Subscribing to Parent Events . 46 Handling Orientation Changes in Your Canvas App . 46 Implementing Canvas App Events . 47 Canvas App Events Considerations . 47 Creating a Canvas App Event . 48 Subscribing to a Canvas App Event . 49 Unsubscribing from a Canvas App Event . 50 Using Streaming API in a Canvas App . 50 Using the Streaming API Event . 51 Subscribing to a Streaming API Event . 51 Unsubscribing from a Streaming API Event . 52 Debugging in a Canvas App . 52 Using the <select> Tag in a Canvas App . 52 Chapter 5: Canvas Apps and Visualforce Pages . 53 Visualforce Page Code Examples . 54 Visualforce Considerations . 55 apex:canvasApp Component . 55 Returning Fields in the Record Object . 58 Using Events between a Visualforce Page and a Canvas App . 59 Publishing a Canvas Event from a Visualforce Page . 60 Resizing a Canvas App in a Visualforce Page . 61 Subscribing to Events . 61 Unsubscribing from Events in a Visualforce Page . 62 Chapter 6: Lightning Component Code Examples . 63 Chapter 7: Canvas Apps in a Page Layout or a Mobile Card . 65 Where Canvas Apps Appear in a Page Layout . 66 Add a Canvas App to a Page Layout . 66 Chapter 8: Canvas Apps in the Publisher . 68 Set Canvas App Location and Create the Action . 69 Create the Action Manually . ..