vRealize Orchestrator (vRO) Send VM Info by Email using HTML Template

In this article we will learn how to send VM information by email using HTML Template. We need to add the HTML template to the resource element tab.

HTML Template

I created the HTML email template and import it to the resource element tab.

Resource Element HTML Template

Create a new workflow as follows and click on the Schema tab.

Workflow Schema

Now let’s add a Scriptable task to the blue arrow and write the following code.

//Template variables
var templateFile = "index.html";
var folder = "Email Template";

var resource = null; //Template

//Get all resources from resources folder
var resElems = Server.getResourceElementCategoryWithPath(folder);
	if(resElem.name == templateFile){
		resource = resElem;
vRO HTML Template Edit

We found the HTML template from the resource element tab. In order to get the VM information, we need to define a parameter of type VC:VirtualMachine as input.

vRO VM parameter

We will communicate with the workflow using the attributes described below.

After defining the parameter and attributes, add the following code to the scriptable task.

//Get DateTime
var today = new Date();

//Resource to MimeAttachment
var mimeResource = resource.getContentAsMimeAttachment();
content = mimeResource.content;
content = content.replace("{{date}}", today.toLocaleDateString() + " - " + 
content = content.replace("{{name}}", VM.summary.config.name);
content = content.replace("{{hostname}}", VM.summary.guest.hostName);
content = content.replace("{{ipAddress}}", VM.summary.guest.ipAddress);
vRO MimeAttachment

Let’s run Workflow and see what happens. We selected the VM as a parameter and filled the information into the HTML template and the workflow worked.

vRO Select VM with parameters

The template is now ready. The completed template will now be sent by email. To do this, we will use the “Send notification” workflow in the library. Let’s drag and drop this workflow to the right of the scriptable task.

vRO Send notification workflow

After clicking on the Setup that appears above, click on the Promote from the window that opens.

At the same time, we have added the input parameters of the workflow.

Run the Workflow

We can see these parameters when you run workflow.

Workflow sent the email according to the filled parameters.

Let’s fill some of the inputs here with attributes and eliminate unnecessary confusion.


Scriptable task Visual Binding:

Send notification Visual Binding:

Test workflow:


That’s it. You can find the HTML template and workflow on my GitHub.

Hopefully this post has been informative for you. If you have a question, opinion or request about the article, you can contact us from the comments below or my email address. If you think this post is informative to others, be social and share it on social media! Thank you for reading !!

2 thoughts on “vRealize Orchestrator (vRO) Send VM Info by Email using HTML Template

Leave a Reply

Your email address will not be published. Required fields are marked *