posted

14 Comments

User Experience (“UX”) focuses on the intimate understanding of your users. What is it that they need or desire, what do they value, what are their abilities, as well as their limitations?

As you embark upon the journey to the software-defined data center (SDDC), think and architect in terms of the user experience in addition to “boxes and arrows.”

  • What are the desired UX outcomes for those consuming the service(s)?
  • Have you considered the UX in terms of its usefulness, usability, desirability, accessibility, credibility, and its value?

In addition to fundamental tenant and business group designs, entitlements and service catalogue designs, one such area for UX consideration is the messages provided to those consuming services of the software-defined data center.

For a moment, imagine you are providing automated infrastructure delivery to multiple business segments of a large media and entertainment organization, each with their own distinct brand. The segments are built upon their individual brand and identity.

  • Do you centrally brand the service that you offer or do you tailor the service to each tenant business segment?
  • How would this change if instead the services were used to provide automated infrastructure delivery only to your IT Operations team and not direct end users?

The messages that appear in the inbox of the user are part of the experience. VMware vRealize Automation can send automatic notifications for several types of events, such as, the successful completion of a catalogue request or a required approval workflow.  System Administrators can configure global email servers, senders and recipients that process email notifications.

Tenant Administrators can override those defaults, or add their own servers, senders and recipients if no global attributes are specified. They may even select which events will cause notifications to be sent to their users. Each component, such as the service catalog or infrastructure-as-a-service, can define events that can trigger notifications.

scenarios

Additionally, each user can choose if they wish to receive notifications. Users either receive all notifications configured by the Tenant Administrator or no notifications.

Notification may also have links that allow the user to perform interactively. For example, a notification about a request that requires approval can have one link for approving the request and one for rejecting it. When a user clicks one of the links, a new email opens with content that is automatically generated. The user can send the email to complete the approval.

Messages can be easily and beautifully customized using a simple, powerful template engine. These may be customized per-locale, per-tenant, and per-notification scenario. You have the ability to define and craft the desired user experience for any notification.

Getting Started with Message Templates

vRealize Automation uses a folder structure to determine the appropriate template to user based on the context of the tenant. Templates files are written in Apache Velocity, an easy to use Java-based template engine. Learn more about the simple directives used in the .vm template files in the Apache Velocity User Guide.

Deploy the Sample Templates

To use message templates in vRealize Automation, you must first obtain the sample templates, customize those templates that you need, and save the templates in the file system of your vRealize Automation appliance(s).

These templates are provided in VMware KB 2088805. Download and copy the vrealize_automation.tar.gz to root “/” the vRealize Automation appliance file system.

  • From Windows, SCP the file to the vRealize Automation appliance with a utility like WinSCP.
  • From Mac or Linux, open and terminal and run the following commands.

​From either Windows, Mac or Linux, SSH to the vRealize Automation appliance(s) and run the following commands to extract the contents to the root of the file system and set the appropriate permissions on the templates.

Restart the VMware vRealize Automation appliance services by running this command:

Before we start crafting the custom messages that for the user experience, let’s examine the structure and contents of these loaded sample templates.

There are three main folders in sample templates:

  • /vcac/templates/email/html/core/:
    Contains core templates for messages.
  • /vcac/templates/email/html/forms/​:
    Contains templates for form layouts.
  • /vcac/templates/email/html/extensions/​:
    Contains templates, which are being used to display fields in IaaS forms.

Below is the file structure:

In the core, extensions, and forms subfolders, there is a folder called defaults. The templates, represented as .vm files, in this folder are used by vRealize Automation when tenant specific templates are not specified.

Understanding Contents of /core/defaults/

Inside the /vcac/templates/email/html/core/defaults/ folder the there are five (5) template files that defined the default message structure.

  • ​main.vm: Required.
    This is the main message and is defined by including / parsing additional template files.
  • styles.vm: Optional.
    Included in the samples to define the CSS </style> element consumed by main.vm.
  • header.vm: Optional.
    Included in the samples to define the HTML </header> element consumed by main.vm.
  • links.vm: Optional.
    Included in the samples to define a set of URLs presented in main.vm.
  • footer.vm: Optional.
    Included in the samples to define a footer message presented in main.vm.

As a reminder, these files are built using an Apache Velocity template engine. Learn about the directives used and available that may be used in the Apache Velocity User Guide.

Let’s take a look at the structure of the ​main.vm.

In the main.vm you can see the basic standard building blocks of an HTML document similar to:

Inside the code blocks, Apache Velocity #parse directives call additional.vm template files, for example:

Pretty simple, right? Plus, there is tons of room to get creative, as you will see later in this post.

If you can follow standard HTML and basic Apache Velocity directives you are already well on your way. When you create your own .vm files and place them into the defaults folder remember to include the core/ before the template name in the #parse directive.

You will also notice there is a call within the </body> element for $body. This directive is calling content for the message based on the notification scenario. Content layouts for the $body element is provided in the /vcac/templates/email/html/forms/​ directory contents.​

Now, let’s move forward and explain how to provide per-tenant, per-locale and scenario based directory structures.

Customizing Per-tenant Templates

As mentioned prior, tenant specific templates can be loaded in the tenants/<tenantName> folder in parallel to the defaults folder.

For example, if your tenant was named “CloudOperations” you would add a /CloudOperations/ folder under the tenants folder.

When a new folder/file is added for customization, you must ensure it has right permissions by executing commands on the vRealize Automation appliance(s).

You need to wait for 120 seconds to see new customizations reloaded and reflected in messages.

Customizing Per-locale Templates

Locale specific templates can be specified in defaults or tenants/<tenantName> folders. These folders can contain further sub-folders for locale specific templates.

When searching for locale-specific template, vRealize Automation searches by country, then language, and on the defaults. ​For example:

When searching for a tenant-specific template, vRealize Automation searches through the tenants folders before searching the defaults folder. A search through these tenant-oriented folders simultaneously inspects for locale. When no tenant information is defined, search is confined to the defaults folder alone.

For example, when searching for a <template.vm> in the locale fr_CA (French Canada) under the CloudOperations tenant the following sequence of paths would be checked in this order:

Customizing Scenario Based Templates 

vRealize Automation 6.1 allows a scenario ID to be used to customize template content.

For example, in a .vm template you could specify a scenario such as:

In vRealize Automation 6.2 we introduced a new, scalable, and recommended approach to scenario based notifications.

Note: 6.2 still supports the 6.1 customization method, but it is not recommended. ​

To customize a template file for a specific scenario, create a file named in the following format:

To create a separate main.vm for the above Resource Activated scenario, create a template file with this name:

A list of scenarios can be found in KB 2088805​ or in Administration > Notifications > Scenarios when logged into vRealize Automation as a Tenant Administrator.

Add Custom Properties

Only available in vRealize Automation 6.2 and later, custom properties that are part of the request form can be added in the email template in this format:

Customizing Scenario Subjects

Only available in vRealize Automation 6.2 and later, the subject line can be customized per notification scenario by creating a template with this naming convention:

To define a subject line for the Resource Activation scenario, create a template as:

The content of this file must be only one line of text:

Putting It All Together

Now you know how to:

  • Load and Set Default Templates
  • Template Directory Structure and Content
  • Default Template Structure and Directives
  • Customizing Per-Tenant Directory Structures
  • Customizing Per-Locale Directory Structures
  • Customizing Scenario Based Templates
  • Customizing Scenario Based Emails

Let’s take this take this to the next level with an example, and create a custom template for a tenant based on what you now know.

 Requirements:
Tenant:                       CloudOperations
Scenario:                    Resource Activated
Locale:                        Default
Template:                   Custom Design
Subject:                      Custom Subject

 Let’s get started….

  1. Obtain the sample templates from KB 2088805 ​.
  2. Open a terminal and run the following commands.
  3. SSH to the vRealize Automation appliance and run the following commands to extract the contents to the root of the file system and set the appropriate permissions on the sample templates.
  4. Restart the VMware vRealize Automation appliance services by running this command:
  5. Create a custom folder for the CloudOperations tenant in the directory structure:/vcac/templates/
  6. Under /vcac/templates/email/html/core/tenants/CloudOperations/ create message and subject templates for the scenario csp.catalog.notifications.resource.activated to be called called when a new requested resource is activated. First, c​reate the file ​subject.vm-csp.catalog.notifications.resource.activated. The first line of the file is edited as seen below.subject.vm-csp.catalog.notifications.resource.activated
  7. Next, ​under /vcac/templates/email/html/core/tenants/CloudOperations/ create the file main.vm-csp.catalog.notifications.resource.activated. If you choose to use custom images, fonts, etc place those resources on an easily accessible web server that the users can access during the render.
  8. In your template, you may want to set some variables to call within the template, such as:

You can call these variables within your template at any time, like so:

Now, I know what you’re thinking. Can I set these as global variables in simply parse that file and call the variable when I need it? Unfortunately, not at this time, but I’m looking into a solution.

What you end up with looks similar to the following.

main.vm-csp.catalog.notifications.resource.activated

And..

callvariables

Once again, remember that when a new folder/file is added for customization, you must ensure it has right permissions by executing commands on the vRealize Automation appliance(s).

​You need to wait for 120 seconds to see new customizations reloaded and reflected in your messages.

Now, let’s put it to work and see what happens when a user requests a new resource from the CloudOperations tenant.

csp.catalog.notifications.resource.activated

Voila! Isn’t that so much better?

Get creative! Define the user experience for messages from vRealize Automation in your software-defined data center and have fun while doing it.

 

 

 

 

About the Author

Ryan Johnson

Ryan Johnson is a Staff Technical Marketing Architect at VMware. As an accomplished technologist his focus is enabling customers and community members to accelerate and simplify their infrastructure services and organizations through the Software-Defined Data Center. Ryan focuses on VMware Cloud Foundation and the VMware Validated Designs.

Follow Ryan on Twitter as @tenthirtyam.