Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

...

  1. Native Context: Listening for the WebViewJavascriptBridgeReady Document event. Native context implies a document loaded through native Pulsar interactions. This includes: launching from an object detail page, a home page tab, a home page replacement app, launching from the content library, loaded from PSL or a Lightning Bolt Menu action.
    IMPORTANT: Prior to Pulsar 12.0, you must call the init method on the bridge before you use it. The function you provide here will receive messages sent over the bridge. This is a great place to add some debug logging as you develop your application.

    Code Block
    languagejs
    let pulsarJSBridge;
    document.addEventListener('WebViewJavascriptBridgeReady', function(event) {
      pulsarJSBridge = event.bridge;
      
      // the presence of pulsarJSBridge.version implies that we are running Pulsar 12.0
      if (typeof pulsarJSBridge.version === 'undefined') {
        pulsarJSBridge.init( function(message, responseCallback) {
          // Add a log for every message that is sent to the Pulsar JS Bridge
          console.log('PulsarJSBridge received message: ', message);
        } );
      }
      
      // you can now make use of pulsarJSBridge!
      // Read on to learn how to send and receive messages as well as best practices for setting up the bridge.
    }, false);

  2. Embedded Context: Copying it from window.parent.pulsar. Embedded context implies a document loaded through the Pulsar Field Service Lightning application.

    Code Block
    languagejs
    let pulsarJSBridge, pulsar;
    if (window.parent.pulsar && window.parent.pulsar.bridge) {
      pulsar = window.parent.pulsar;
      pulsarJSBridge = window.parent.pulsar.bridge;
      // there is no need to call init on this version of the bridge as it has already been initialized by Pulsar FSLfor SFS
    } else {
      console.warn('Something is wrong, unable to locate the Pulsar JS Bridge. Are you sure you are in an embedded state?')
    }

...

Here is a list of events that you can register to listen for and a general description for each. Many of these are not intended for general consumption, but we provide them here anyway. Items 1 through 6 are most pertinent to development of custom apps.

  1. dispatchToHomeApp’ – issued by Pulsar to communicate with the home page replacement app. In FSLWhen Pulsar for SFS is enabled, this sends messages to FSLintended for use by Pulsar for SFS.

  2. 'invalidateLayout’ – issued by Pulsar when we have received an update to the Salesforce objects layout information. An application may need to re-read layout or schema information in this case in order to re-render a layout properly.

  3. syncDataStarted’ – issued by Pulsar to indicate that a data sync has started.

  4. syncDataUpdate’ – issued by Pulsar to inform an update about the status of a sync. Information in this message will include a percentage complete.

  5. syncDataCoreFinished’ – issued by Pulsar when the data part of a sync has completed. Indicating that documents or images may still need to be sync’d.

  6. syncDataFinished’ – issued by Pulsar to indicate that the sync is completed.

  7. dismissToHome' – issued by Pulsar to inform the UI to dismiss any existing modal windows for a return to a home state.

  8. alert’ – issued whenever Pulsar will show an alert to inform the user of an event that needs their attention. This is often used for errors and will result in a modal popover or toast to be presented by the UI.

  9. sobject’ – issued by Pulsar to inform our UI of changes to sobject detail screens. This is used for object creation, editing, displaying list views or detail views.

  10. document’ – issued by Pulsar to inform the UI of updates to sync status of the Documents.

  11. quickaction’ – issued by Pulsar to execute a quickaction in the current UI context.

  12. flow’ – issued by Pulsar to execute a flow step in the current UI context.

  13. launchDocument' – issued by Pulsar to open a Document in a modal window. This document will be in a Native Context.

  14. setContentTitle’ – issued by Pulsar to update the title of a modal window for a content document.

getDocumentPath

This method is used to generate a path to a given document node in your custom app. It takes a document node as an argument and will walk the DOM and build a string that can be used by native Pulsar when generating PDFs. This was designed specifically for this function and was meant to help construct arguments for PDF generation, namely providing the header, body and footer nodes.

...