VMware Cloud Community
StefanSchnell
Enthusiast
Enthusiast
Jump to solution

Is there a way to Create Folders for Configuration Elements Automatically?

Today I tried to create a folder in the configurations of the orchestrator via JavaScript runtime environment, but I don't find a way to handle this. I could imagine it on the following way, but I can not find a method.

 

var myNewFolder = Server.getConfigurationElementCategoryWithPath("myFolderCollection/myNewFolder");
if (!myNewFolder) {
  // Command to create ConfigurationElementCategory?
  // createConfigurationElementCategory("myFolderCollection/myNewFolder");
  myNewFolder = Server.getConfigurationElementCategoryWithPath("myFolderCollection/myNewFolder");
}

 

To do that manually I have to add it easily via New Folder button.

StefanSchnell_0-1676022732908.png

To remove an existing configuration element folder I found the method removeConfigurationElementCategory, but no opposite.

Thanks for hints and tips.


More interesting information at blog.stschnell.de

Reply
0 Kudos
1 Solution

Accepted Solutions
xian_
Expert
Expert
Jump to solution

There is no such function. A folder is created if necessary, if you create a conf element:

Server.createConfigurationElement("newFolder","newElement");

So if you really need an empty folder, create a dummy conf element and remove it:

var ce = Server.createConfigurationElement("newFolder","newElement");

Server.removeConfigurationElement(ce);

View solution in original post

2 Replies
xian_
Expert
Expert
Jump to solution

There is no such function. A folder is created if necessary, if you create a conf element:

Server.createConfigurationElement("newFolder","newElement");

So if you really need an empty folder, create a dummy conf element and remove it:

var ce = Server.createConfigurationElement("newFolder","newElement");

Server.removeConfigurationElement(ce);

StefanSchnell
Enthusiast
Enthusiast
Jump to solution

Thank you very much @xian_ for this clarification.


More interesting information at blog.stschnell.de

Reply
0 Kudos