FlexDeploy 5.6 introduces an exciting new feature called Notification Templates. These templates allow users to style and customize email content based on FlexDeploy build, deploy, and release events. You now have full control to change the style of a notification, augment with other relevant data, or remove data that is simply seen as noise.

What’s going on in there?

The notification templates are defined using Apache Velocity, which is a Java-based template engine. It provides users with a simple yet powerful template language to reference objects defined in Java code. When events are triggered in FlexDeploy, the payload representing that event is sent to the template as a Java object. That data can be used to output both the email subject and the email body content. You are no longer bound by the style and content of the default notifications.

Pre-Built FlexDeploy Templates

FlexDeploy comes with default notification templates for events such as “Pipeline Gate Approval Assigned” or “Workflow Request Failed”. Don’t like the style or the content? Have a different activity that requires notification? Simply copy the default template to create your own, modify to meet your requirements, and map the new template to the appropriate event. All emails for the event will now be delivered with the subject and body generated by your template.

Using the FlexDeploy Notification Templates

The first thing you will notice is that this feature is delivered using the next generation user experience, which will be rolled out across the entire FlexDeploy application over the next 18-24 months.

Each of the 20 events are assigned a default read-only template that is provided by FlexDeploy out of the box. These templates are the starting point for you to build your own notifications that map to your needs.

Notification Home Screen in FlexDeploy

Simply click on the pencil located next to the template you wish to view or edit.

Editor window for FlexDeploy Notification Templates

You will notice that the default template is read-only. To modify, create your own by making a copy, and providing a new name. You can reassign your new template to the event(s), or do it later after confirming you have the style and content you want.

See It In Action

I’ve created a new template for the Folder Approval Assigned event by copying the default template provided by FlexDeploy. The data representing the event is available to the template via the $payload variable, which can be used in both the subject and body to fetch the data elements you want to display.

Naming a Copy of the Default Notification Template

The code editor has a number of features that make it easy to build content from the payload.

Content Preview

First, let’s preview what the result of the subject template looks like, as generated by the script we copied from the default template. The preview function mocks up a sample payload by extracting random data from your FlexDeploy repository.

Editing subject text Subject text preview window

Code Assist

Now let’s modify the template’s email subject. We’ll change the text a bit and add the name of the application. The editor offers code assist features to show which methods are available on the payload, and any of the objects its methods return. Simply click Ctl+Space to see what methods are available, along with the description of the highlighted method.

Object options

Preview Window Live Update

After completing the change, we can see the preview window updates live and it is correctly displaying the application name.

Viewing preview window updates live

HTML in Email Body

The same exact concepts applies to the email body. The only difference is that the body template can produce HTML, and it most certainly will display richer content. Let’s preview the body without making any changes. You’ll notice that the default templates have a fresher look than the emails which were generated in previous FlexDeploy versions.

New and updated notification layout

Save Your Customized FlexDeploy Notification Templates

Save your changes to the template and be sure to assign the template to the appropriate event(s). All notifications that are triggered for this event will be delivered to recipients using the content formatted by the assigned template.

Conclusion

FlexDeploy Notification Templates put the styling and content generation in your hands. Create the style and content that meets your requirements. Explore the rich capability of Apache Velocity templates and create beautiful things!

Stay up to date on the latest FlexDeploy news! Subscribe to get weekly blog notifications.


Share this:
Erick Jones

I have been working with Java EE technologies for 25 years, and have applied industry experience implementing IBM and Oracle solutions. Through my architecture and development experience I have implemented several homegrown and third party automation solutions to manage the software delivery lifecycle. At Flexagon I am a DevOps evangelist, with a passion for helping customers deliver software to their customers faster, cheaper, and with higher quality. My primary focus is on FlexDeploy product strategy, and pre-sales and post-sales implementations.

More posts by Erick Jones
    

Leave a Reply

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