Get Configuration Element Attribute Value from Aria Automation Orchestrator

In this post I show you how you can get a Configuration Element Attribute from an Aria Automation Orchestrator Configuration Element. I am using that to get e.g. the Aria Automation Host (former vRealize Automation) from an Orchestrator Configuration Element. This is very useful to get the Automation Host in an Orchestrator Action.

See also in post Get a Aria Automation Orchestrator (former vRealize Orchestrator) Configuration Element by Global Tag name

Create a Orchestrator Action with following Inputs and Return type:

  • categoryPath (type string)
  • cfgName (type string)
  • attributeName (type string)
  • Return type any

Add the following code into the Script canvas:

var category = Server.getConfigurationElementCategoryWithPath(categoryPath);
if (category == null)
{
  throw("Configuration element path '" + categoryPath + "' not found!!");
}

var cfgElements = category.configurationElements.filter(function(element) {  
	return element.name == cfgName;  
});

//Get attribute names
if(cfgElements != null && cfgElements.length == 1){
for (attribute in cfgElements[0].attributes)
{
	if(cfgElements[0].attributes[attribute].name == attributeName){
	if(cfgElements[0].attributes[attribute].value){
		return cfgElements[0].attributes[attribute].value;
	}
}
}
}else{
	throw("Configuration name '" + cfgName + "' not found or not unique!!");
}

CREATE / SAVE the Action

Similar Posts

Leave a Reply

Your email address will not be published.

WC Captcha + 21 = 26