Custom Macros

Summary

You can create your own Macro content that can be used within your custom templates. This is created within JEMHC > Notifications > Templates > Custom Macros. Macros allow you to define the macro content once but use it within multiple Templates.

 

Creating a New Macro

  1. Press Edit. This changes the macros from read only mode to edit mode. This will then allow you to create and modify the Macros.

  2. Type #macro (MacroName) This defines the start of the new macro. Once the Macro content has been created you must then use #end to define the end of the Macro. For example below:

    #macro (MacroName) <p>This is a example Macro</p> #end

Macro Previewer

The Custom Macros can be tested by:

  1. Selecting a Preview Context

  2. Selecting a Theme

  3. Calling the relevant Macro within the Scratchpad using the following format #MacroName

  4. Press the Preview button (Eye icon)

This will then show a preview of the macros that have been added to the scratchpad. Here you are able to select whether you would like to view the Text format or the HTML format.

Calling Macro within Template

To use a Macro within the Template you will need to call the macro. This will then result in the Macro being run and showing the relevant information on the template. e.g.

Custom Macro

#macro ( exampleCopyOfIssueType)

Calling Macro Within Template

#exampleCopyOfIssueType()

Using Macro Parameters

Parameters can be passed to macros by modifying the macro definition:

Calling Macro with parameters in template

or

Email hasn't been sent as no useful information was displayed based on the used template.

When a notification is rendered all Velocity macros are processed and their output is placed into the body of the notification. This will always result in static Macro content like the header and the footer of the notification being rendered which is fine unless there is no tangible or useful content to the notification. For example, you could find yourself receiving notifications that have a header, a footer and absolutely nothing else because the Macros that output the comments - for whatever reason - found no comments in the event.

To put a stop to wasteful notifications we provide a feature where the notification will be ignored if one of these two methods are not called anywhere within the macros in the Template Set used by the Notification Mapping.

The two methods are:

Note - these do not control whether to display the comment or fields themselves, instead these methods control whether to display the entire notification or not. The Template Set is run once for each recipient user and if neither of these methods is called for an individual user then that user won't get the notification. It's possible that a macro will call one of the methods for, say, a JSD agent but not for a JSD customer - such as when an internal comment is made.