vRealize Automation 7 – Custom Email Template XaaS Cleanup

A customer recently contacted me to help resolve a few issues with vRA 7’s custom email templates. Here are some of the changes I had to make.

  1. Templates have been updated from 6.2. Grab the new templates from the ‘Attachments’ section in the following KB: https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2102019 
  2. Multiple XaaS (anything as a Service) workflows are displayed in the Approval notice. This may be the intent, but in this case the customer just wanted to see the ‘Virtual Machine’ properties of the request.

So once you follow the KB above and install the current templates for v7, you will end up with the following default directory on the vRA server

  • /vcac/templates/email/html/extensions/defaults/

Today I learned that there is yet another language that exists. The templates are written in Apache Velocity. For my purposes, syntactically it wasn’t too bad.

Only Looping over the ‘Virtual Machine’ component

This is a screenshot of the vRA 7 design view. Notice in addition to the VM blueprint, we also have a XaaS workflow attached.

To handle the XaaS issue where the customer only wanted to see the ‘Virtual Machine’ properties, I modified the ‘componentInfo.vm’ template. The template grabs a handful of properties like (Machine Name, Machine Type, Lease time, etc) and then generates the associated HTML to display it. Because, each XaaS workflow is it’s own component, a loop in the template iterates over all of them.

This screenshot shows the default template displaying data for all components (XaaS and VM)

To fix this:

  1. Add a condition to filter for the ‘Virtual Machine’ component type. This should be added right below the last ‘#set’ statement. Of course this could be any condition you want.
  2. Add the ‘#end if’ statement just above the ‘##For loop’ comment at the end of the template.

Here is the result:

Hope that helps.

Leave a Reply

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