Loading
Upcoming Mandatory Changes to Public Key Infrastructure (PKI)Read More
Salesforce Enforces New Security Requirements in Summer 2026Read More
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Create a Connection Object in OmniOut

          Create a Connection Object in OmniOut

          Create a connection object to send and receive data with Salesforce. A connection object is required for all connection types, including proxies. The connection object exposes the instance URL, namespace, and request function.

          If your OmniOut project has Omniscripts, create an event handler to pass the connection object after you get the omnioutcomponentready event.

          Note
          Note If your OmniOut project only has Flexcards, use the initializeDatasourceSdk method to connect your app. See Create a Connection Object in OmniOut for Flexcards.
          Note
          Note The connection process is unique to each application and needs to be set up separately from OmniOut.

          Before You Begin

          Add the OmniOut project to your application. See Move OmniOut to Your App.

          To create a connection object, perform these tasks.

          1. Create an event handler.

            Example Event Handler

            /**
              * Once the component is ready, an event is dispatched to let the DOM knows that a connection is expected.
             **/
            document.addEventListener('omnioutcomponentready', evt => {
                  if (evt.detail && evt.detail.omnioutcomponent) {
                    evt.srcElement.connection = new YourOmniOutConnection();
                  }
                });
          2. Create a connection object.

            Example Connection Object

             function BaseConnectionExample() {
                  /**
                   * Expose the request method
                   **/
                  this.request = request;
            
                  /**
                   * @type {string} The namespace of the package
                   **/
                  this.namespace = '';
            
                  /**
                   * @type {string} The instance URL of your org
                   **/
                  this.instanceUrl = '';
            
                  /**
                   * A function that executes the HTTP requests.
                   * @type {string} The target URL.
                   * @type {Object} The data that is sent to the target URL.
                   * @returns {Promise} A promise with the 
                   **/
                  function request(url, data) {
                    return connection.requestPost(url, data);
                  }
                }
          3. Configure additional connection options outside of OmniOut.
           
          Loading
          Salesforce Help | Article