Need to get properties or other IDs and information from Aria Automation resources inside Orchestrator JavaScript code
search cancel

Need to get properties or other IDs and information from Aria Automation resources inside Orchestrator JavaScript code

book

Article ID: 383399

calendar_today

Updated On: 04-11-2025

Products

VMware Aria Suite

Issue/Introduction

  • Aria Automation and Orchestrator refer to objects like virtual machines using different reference IDs.
  • There may be resource properties which are available in Automation which you need to access in Orchestrator workflow scripts.
  • You can see these properties as input variables in the workflow run, for example:
    • __metadata_projectId
    • __metadata_deploymentId
    • __metadata_userName
    • __metadata_resourceProperties
  • Creating a Resource Action (Day 2 Action) in Aria Automation, having difficulty using Property Binding or otherwise accessing resource data
  • Creating a Subscription (Extensibility) in Aria Automation, having difficulty accessing resource data

Environment

  • VMware Aria Automation Orchestrator 8.x

Resolution

These variables can be accessed with the System.getContext().getParameter() function in your workflow.

 

For example, to get values from inside the __metadata_resourceProperties object, where most properties are kept:

  1. var properties = System.getContext().getParameter('__metadata_resourceProperties');
  2. Now you can grab vRA custom properties within this object, e.g.:
    • properties.resourceId

 

  • The variables passed to the workflow in this way can be seen in the Variables section of the workflow run
    • If you are unsure of the resource property name, please create the workflow and run it once.
    • Then check the Variables section as shown below, to find available metadata variables.
  • Note that for Subscriptions, the workflow may also use an Input of type Properties which is named inputProperties to access the given inputs

 

Code Sample:

var context = System.getContext();

// Print the deployment ID and project ID:
System.log("Deploy ID:  " + context.getParameter("__metadata_deploymentId"));
System.log("Project ID: " + context.getParameter("__metadata_projectId"));

// Print the Blueprint ID:
System.log("Blueprint ID :  " + context.getParameter("__metadata_resourceProperties").__blueprint_id);

// Print all VM tags in "key: value" format:
var tagArray = context.getParameter("__metadata_resourceProperties").tags;
tagArray.forEach(function(tag) {
    System.log(tag.key + ": " + tag.value);
});