Customizing advanced field templates

This page provides details on customizing advanced field templates.

Template syntax

If you wish to control which fields to display and how, you will need to customize the template further with Velocity syntax.

Fields are accessed with the following syntax:

$!fields.get(<Field Name>) where <Field Name> is the name of the field in the object e.g. Description in the Salesforce Case object.

Field names for standard Salesforce objects can be looked up in the link above to the data object descriptions, which is part of the Salesforce Application Programming Interface (API).

But if the field name has a period in it (e.g. "Account.Name"), try using:

$fields.get("Account.Name")

If you want to provide a link to the Salesforce object, you can retrieve this URL with the following:

$url

A practical example of how to use the above syntax is shown below. In this example, fields from the Salesforce Case object are displayed.

In a Jira issue this displays like:

 

In the above example, the Case Subject is linked back to that particular case in Salesforce and opens in a new window.

If any of the fields do not exist, then the $!fields.get(<Field Name>) line will appear as-is for that field, which does not look visually harmonious.

To hide fields if they do not exist, we can alter the above example as below, which checks for the existence of a field value before displaying the line for that value: