Rendering Insight attributes into a velocity template

If you are using the Email This Issue plugin and want to include the Insight attributes stored in an Insight custom field this is how you write it in the velocity template. 

Attributes that are not of the type Default will be rendered as their ID and not the String representation. e.g. an attribute of type Project will render the ProjectId and not the ProjectName.

Attribute of Default type will be rendered with the String representation e.g. Text, Textarea, email etc

Instructions

Create a template and open it for HTML editing.

Copy and paste the below code into a text file, then into your template (this is just a safety measure to avoid HTML problems:

#set($insightCustomField = $!customfieldManager.getCustomFieldObject("customfield_10000"))
 
#set($objectBeans = $!issue.getCustomFieldValue($!insightCustomField))
 
 
#foreach( $objectBean in $!objectBeans)
    $!objectBean.getLabel()
    #foreach( $attributeBean in $!objectBean.getObjectAttributeBeans())
        #foreach( $attributeValueBean in $!attributeBean.getObjectAttributeValueBeans())
             $!attributeValueBean.toString()
        #end
    #end
#end


This article may also be found in the official Riada documentation.



.