ShilpaNagaraja
Contributor
Contributor

vRO- Using Configuration element in Actions

Hi,

I am trying to use 

 

var configurationElementPath  = "Configurations/web-root";
var configurationElementName  = "vpNames";
var attributeName = "vpNames";
try{
var category = Server.getConfigurationElementCategoryWithPath(configurationElementPath);
}
catch(e){
    System.log(e);
}

for each ( var element in category.configurationElements) { 
    if (element.name == configurationElementName) {
        var configurationElement = element;
    }
 } 
return configurationElement.getAttributeWithKey(attributeName).value;
=====================================
category = Server.getConfigurationElementCategoryWithPath(configurationElementPath); ----- returns null, is the path that i am using is in correct format? or is there anything I am missing here.
my configurations in under : Configurations > web-root >>configElement>
 
Any inputs are greatly appreciated.
0 Kudos
2 Replies
ShilpaNagaraja
Contributor
Contributor

There are no exceptions,

I get the following error:

Action 'getConfigElementVP' in module 'com.shnagaraja.actions' failed : TypeError: Cannot read property "configurationElements" from null (com.shnagaraja.actions/getConfigElementVP#11)

0 Kudos
Jeff_CH
Enthusiast
Enthusiast

The correct path is just "web-root":

var configurationElementPath = "web-root";
var testcategory = Server.getConfigurationElementCategoryWithPath(configurationElementPath);
System.log(testcategory)

This will return:

2021-01-20 07:37:32.228 +01:00INFOConfigurationElementCategory:ch.dunes.scripting.jsmodel.JSConfigurationElementCategory@7e784d38

If you use any subfolder in web-root, then you'll have to use "web-root/<subfolder>"