Skip Navigation
Expand
BUI Extension displays Default Value for Workspace Properties
Answer ID 11810   |   Last Review Date 03/26/2021

Why does my property on my workspace extension only return the default value in my properties file when I expect it to return the value set for the workspace?

Environment:  

Browser UI (BUI) Extensions

Issue:  

The workspace getProperties() collection on globalContext do not change when the properties are set in the workspace Design section.


  extensionProvider.getGlobalContext().then(function(globalContext) {
     globalContext.getExtensionContext('extensionName').then(function(extensionContext) {
  

 

Resolution:  

The workspace extension does not have any properties to return, the gloabalConext header owns the properties, as well as the changed properties.

The Extension Context relates to the properties owned by the extension. This is also why the default properties are returned when getProperties is called.

In order to get the new properties set in the workspace for the extensions use the getContainerContext(). The getContainerContext will use the workspace as the context in order to get the workspace properties.

 

Notes: 

Extension Configuration
  
  ORACLE_SERVICE_CLOUD.extension_loader.load("test_workspace_properties", "1")
      .then(function(extensionProvider) {
        extensionProvider.getGlobalContext().then(function(globalContext) {
          globalContext.getContainerContext().then((cContext) => {
            console.log(cContext);
            cContext.getProperties(['Property1', 'Property2']).then((collection) => {
              var ext1 = collection.get('Property1').getValue();
              var ext2 = collection.get('Property2').getValue();
              console.log("Property1: " + ext1);
              console.log("Property2: " + ext2);
            });
          }).catch(function(err) {
            console.log(err)
          });
        });
      });

 

Set up the Containers context then do getProperties on that container.

getContainerContext
getProperties

The extension configuration can be found in the Agent Browser UI Extensibility Framework Developer Guide