Search this space

Live demo

Want to see a live demo and learn what this Connector can do? Join our jam sessions!

Page tree

If you are looking for documentation for the new Salesforce & JIRA Cloud Connector, click here.

Skip to end of metadata
Go to start of metadata

Introduction


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.

*Salesforce Case:* [$fields.Subject|$url]
*Salesforce Case Number:* $fields.CaseNumber
*Salesforce Priority:* $fields.Priority
*Salesforce Status:* $fields.Status

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:

#if($fields.Subject)
    *Salesforce Case:* [$fields.Subject|$url]
#end
#if($fields.CaseNumber)
    *Salesforce Case Number:* $fields.CaseNumber
#end
#if($fields.Priority)
    *Salesforce Priority:* $fields.Priority
#end
#if($fields.Status)
    *Salesforce Status:* $fields.Status
#end
Page Contents

  • No labels