Documentation

    Salesforce Visualforce Example

    Complete Salesforce Implementation

    This example shows how to add presentation sharing to a Salesforce Visualforce page.

    Visualforce Page

    <apex:page>
      <script>
        // HelloScreen SDK compatibility flag for Lightning/Aura
        window.__upscopeFlags__ = ["aura_compatibility"];
    
        // ... rest of code found on https://helloscreen.com/install
    
        // Pass additional metadata about the current context
        Upscope("updateConnection", {
          metadata: {
            recordId: "{!record.Id}",
            recordType: "{!record.RecordType.Name}"
          }
        });
    
        // Agent identification from Salesforce user
        var agentId   = '{!$User.Id}';
        var agentName = '{!JSENCODE($User.Name)}';
    
        function showLink() {
          Upscope("getPublicLink", {
            agentId: agentId,
            agentName: agentName
          }, function(link) {
            alert("Share this link with the customer: " + link);
          });
        }
      </script>
    
      <button onclick="showLink()">Get Public Link</button>
    
      <!-- Your presentation content here -->
      <apex:pageBlock title="Presentation">
        <!-- ... -->
      </apex:pageBlock>
    </apex:page>
    

    Key Points

    1. Aura Compatibility Flag: The window.upscopeFlags = ["aura_compatibility"] line ensures the SDK works correctly within Salesforce's Lightning framework.
    2. User Context: We use Visualforce merge fields ({!$User.Id}, {!JSENCODE($User.Name)}) to automatically get the current Salesforce user's information.
    3. JSENCODE: Always use {!JSENCODE()} for string values to prevent issues with quotes.
    4. Metadata: Pass relevant Salesforce record information via updateConnection to provide context in reports.
    \n\n \n\n \n \n \n \n\n"}]},{"type":"section","id":"complete-salesforce-implementation-key-points","title":"Key Points","level":3,"link":"https://cobrowsingapi.com/docs/presentation-sharing/salesforce-example#complete-salesforce-implementation-key-points","children":[{"type":"list","id":"list-0","children":[{"type":"list-item","id":"aura-compatibility-flag","title":"Aura Compatibility Flag","content":"The `window.__upscopeFlags__ = [\"aura_compatibility\"]` line ensures the SDK works correctly within Salesforce's Lightning framework.","link":"https://cobrowsingapi.com/docs/presentation-sharing/salesforce-example#complete-salesforce-implementation-key-points::li::aura-compatibility-flag-the-window__upscopeflags__-aura_compatibility-line-ensures","meta":{"raw":"**Aura Compatibility Flag**: The `window.__upscopeFlags__ = [\"aura_compatibility\"]` line ensures the SDK works correctly within Salesforce's Lightning framework."}},{"type":"list-item","id":"user-context","title":"User Context","content":"We use Visualforce merge fields (`{!$User.Id}`, `{!JSENCODE($User.Name)}`) to automatically get the current Salesforce user's information.","link":"https://cobrowsingapi.com/docs/presentation-sharing/salesforce-example#complete-salesforce-implementation-key-points::li::user-context-we-use-visualforce-merge-fields-userid","meta":{"raw":"**User Context**: We use Visualforce merge fields (`{!$User.Id}`, `{!JSENCODE($User.Name)}`) to automatically get the current Salesforce user's information."}},{"type":"list-item","id":"jsencode","title":"JSENCODE","content":"Always use `{!JSENCODE()}` for string values to prevent issues with quotes.","link":"https://cobrowsingapi.com/docs/presentation-sharing/salesforce-example#complete-salesforce-implementation-key-points::li::jsencode-always-use-jsencode-for-string-values-to","meta":{"raw":"**JSENCODE**: Always use `{!JSENCODE()}` for string values to prevent issues with quotes."}},{"type":"list-item","id":"metadata","title":"Metadata","content":"Pass relevant Salesforce record information via `updateConnection` to provide context in reports.","link":"https://cobrowsingapi.com/docs/presentation-sharing/salesforce-example#complete-salesforce-implementation-key-points::li::metadata-pass-relevant-salesforce-record-information-via-updateconnection","meta":{"raw":"**Metadata**: Pass relevant Salesforce record information via `updateConnection` to provide context in reports."}}],"meta":{"ordered":true}}]}]}]},"https://cms-cdn.helloscreen.com/www/data/docs-index-ml702hue-caa525e6.json":[{"slug":"browser-extension/install-extension","title":"Install the Browser Extension","order":1,"categoryOrder":1,"segmentOrders":[1,1]},{"slug":"browser-extension/sharing-tabs","title":"Sharing Tabs","order":2,"categoryOrder":1,"segmentOrders":[1,2]},{"slug":"browser-extension/customization","title":"Customization","order":3,"categoryOrder":1,"segmentOrders":[1,3]},{"slug":"browser-extension","title":"Browser Extension","order":999,"categoryOrder":1,"segmentOrders":[1,999]},{"slug":"document-sharing/starting-presenation","title":"Starting a presentation","order":1,"categoryOrder":2,"segmentOrders":[2,1]},{"slug":"document-sharing/creating-templates","title":"Creating Templates","order":2,"categoryOrder":2,"segmentOrders":[2,2]},{"slug":"document-sharing/customization","title":"Customization","order":3,"categoryOrder":2,"segmentOrders":[2,3]},{"slug":"document-sharing","title":"Document Sharing","order":999,"categoryOrder":2,"segmentOrders":[2,999]},{"slug":"presentation-sharing/sdk-integration","title":"SDK Integration","order":1,"categoryOrder":3,"segmentOrders":[3,1]},{"slug":"presentation-sharing/getting-public-link","title":"Getting Public Links","order":2,"categoryOrder":3,"segmentOrders":[3,2]},{"slug":"presentation-sharing/salesforce-example","title":"Salesforce Visualforce Example","order":3,"categoryOrder":3,"segmentOrders":[3,3]},{"slug":"presentation-sharing","title":"Presentation Sharing","order":999,"categoryOrder":3,"segmentOrders":[3,999]},{"slug":"cobrowsing-mode/sdk/web/installation","title":"Installation","order":1,"categoryOrder":4,"segmentOrders":[4,1,1,1]},{"slug":"cobrowsing-mode/sdk/web/configuration-options","title":"Configuration Options","order":2,"categoryOrder":4,"segmentOrders":[4,1,1,2]},{"slug":"cobrowsing-mode/sdk/web/sdk-functions","title":"SDK Functions","order":3,"categoryOrder":4,"segmentOrders":[4,1,1,3]},{"slug":"cobrowsing-mode/sdk/web/listening-for-events","title":"Listening for Events","order":4,"categoryOrder":4,"segmentOrders":[4,1,1,4]},{"slug":"cobrowsing-mode/sdk/web/translations","title":"Multi-Language Support","order":5,"categoryOrder":4,"segmentOrders":[4,1,1,5]},{"slug":"cobrowsing-mode/sdk/web","title":"Web SDK","order":999,"categoryOrder":4,"segmentOrders":[4,1,1,999]},{"slug":"cobrowsing-mode/sdk/ios/installation","title":"Installation","order":1,"categoryOrder":4,"segmentOrders":[4,1,2,1]},{"slug":"cobrowsing-mode/sdk/ios/configuration-options","title":"Configuration Options","order":2,"categoryOrder":4,"segmentOrders":[4,1,2,2]},{"slug":"cobrowsing-mode/sdk/ios/sdk-functions","title":"SDK Functions","order":3,"categoryOrder":4,"segmentOrders":[4,1,2,3]},{"slug":"cobrowsing-mode/sdk/ios/listening-for-events","title":"Listening for Events","order":4,"categoryOrder":4,"segmentOrders":[4,1,2,4]},{"slug":"cobrowsing-mode/sdk/ios","title":"iOS SDK","order":999,"categoryOrder":4,"segmentOrders":[4,1,2,999]},{"slug":"cobrowsing-mode/sdk/android/installation","title":"Installation","order":1,"categoryOrder":4,"segmentOrders":[4,1,3,1]},{"slug":"cobrowsing-mode/sdk/android/configuration-options","title":"Configuration Options","order":2,"categoryOrder":4,"segmentOrders":[4,1,3,2]},{"slug":"cobrowsing-mode/sdk/android/sdk-functions","title":"SDK Functions","order":3,"categoryOrder":4,"segmentOrders":[4,1,3,3]},{"slug":"cobrowsing-mode/sdk/android/listening-for-events","title":"Listening for Events","order":4,"categoryOrder":4,"segmentOrders":[4,1,3,4]},{"slug":"cobrowsing-mode/sdk/android","title":"Android SDK","order":999,"categoryOrder":4,"segmentOrders":[4,1,3,999]},{"slug":"cobrowsing-mode/sdk/element-masking","title":"Element Masking","order":999,"categoryOrder":4,"segmentOrders":[4,1,999]},{"slug":"cobrowsing-mode/sdk/identifying-the-visitor","title":"Identifying the Visitor","order":999,"categoryOrder":4,"segmentOrders":[4,1,999]},{"slug":"cobrowsing-mode/sdk","title":"SDK Documentation","order":999,"categoryOrder":4,"segmentOrders":[4,1,999]},{"slug":"cobrowsing-mode/sdk/the-lookup-code","title":"The Lookup Code","order":999,"categoryOrder":4,"segmentOrders":[4,1,999]},{"slug":"cobrowsing-mode/session-basics","title":"Session Basics","order":2,"categoryOrder":4,"segmentOrders":[4,2]},{"slug":"cobrowsing-mode/on-premise","title":"On-Premise Deployment","order":3,"categoryOrder":4,"segmentOrders":[4,3]},{"slug":"cobrowsing-mode/agent-led-sessions","title":"Agent-Led Sessions","order":5,"categoryOrder":4,"segmentOrders":[4,5]},{"slug":"cobrowsing-mode/agent-prompt","title":"Agent Prompt","order":6,"categoryOrder":4,"segmentOrders":[4,6]},{"slug":"cobrowsing-mode","title":"Cobrowsing Mode","order":999,"categoryOrder":4,"segmentOrders":[4,999]},{"slug":"team-setup/invite-team","title":"Invite Your Team","order":1,"categoryOrder":5,"segmentOrders":[5,1]},{"slug":"team-setup/saml","title":"SAML SSO","order":2,"categoryOrder":5,"segmentOrders":[5,2]},{"slug":"team-setup","title":"Team Setup","order":999,"categoryOrder":5,"segmentOrders":[5,999]}]};