Skip to main content

Init

Initializes the widget by establishing a secure connection with the host application and preparing the SDK environment for further interactions.

Commonly used for :
  • Establishing communication between the widget and the host application
  • Validating widget permissions and context
  • Preparing access to SDK methods such as get, set, and invoke
  • Ensuring the widget is ready before executing any business logic
How it works :

The init method must be called as soon as the widget loads. It returns a promise that resolves once the widget is successfully initialized. All SDK operations should be executed only after this promise is resolved.

Usage notes :
  • init must be the first SDK method called in the widget lifecycle
  • Calling other SDK methods before init may result in unexpected behavior
  • The returned app instance is used to access all other SDK functionalities
Sample Code :
REQUEST DETAILS
window.onload = function () {
  ZFAPPS.extension.init().then(function(App) {
    /* Below is an example to get the organization details */
    ZFAPPS.get('organization').then(function (data) {
     //response Handling
    }).catch(function (err) {
     //error Handling
    });
  });
}