Skip Navigation
Expand
Working with Library Extensions in BUI Extensibility Framework
Answer ID 10382   |   Last Review Date 07/30/2019

How to I reference Library extensions in other BUI extensions?

Environment:

Oracle Service Cloud, Browser User Interface Extensibility Framework, all product versions

Resolution:

JavaScript libraries such as jQuery can be loaded from outside the extensibility framework, but this is not recommended. The reason is that the framework will not provide any caching mechanism for such files and it does not have any control over them.

Extensibility framework has an inbuilt approach called Library Extension to achieve this. This has the following advantages: 

  1. Library extensions are cached and managed by the extensibility framework itself.
  2. A single library extension can be shared by all the extensions. In scenarios where multiple extensions need common scripts like jquery.js, you can upload the scripts as a library extension and then this script can be referenced in any other extensions.

Here are the steps to creating a Library Extension:

  1. Open the Add-in Manager in Agent Desktop Console
  2. Add a new extension
  3. Upload the file that needs to be shared across multiple extensions (for example let's say "jquery.js")
  4. Set extension type as "Library"
  5. Set the necessary profile permissions.
  6. Save the extension

Here is how you would reference the library extension (common script file) in another extension:
 
To refer any script of library extension in any other extension, the relative path of the script should be specified in the extension.
Note: In extensibility, every file path is constructed in the format: ExtensionName/Filepath

Suppose we have:

  • A Library extension with name Lib1
    • The file structure of Lib1:
      • /jquery.js
  • Another extension with name Ext1
    • The file structure of Ext1:
      • /index.html
      • /js/
        • script1.js
        • script2.js 
  1. To refer jquery.js from index.html of Ext1
    jquery.js of Lib1 can be referred to as: ../Lib1/jquery.js
     
  2. To refer jquery.js from script1.js of Ext1
    jquery.js of Lib1 can be referred to as:  ../../Lib1/jquery.js
     
  3. To refer jquery.js from script2.js of Ext1
    jquery.js of Lib1 can be referred to as:  ../../Lib1/jquery.js
More information about extensions can be found in the Extensibility Framework product documentation:
Answer ID 5169: Technical Documentation and Sample Code

Available Languages for this Answer:

Notify Me
The page will refresh upon submission. Any pending input will be lost.