Use Jira Assets (Insight) Custom Fields

Summary

SINCE 4.1.12

We have implement some new API classes that provides some methods to extract values from the Insight/Asset objects. These can be used within both JavaScript (Script Field Processor, Script Rule and Script Pre-Proc Task) and Velocity (Templates and Custom Field Defaults).

Velocity Context available for Assets

Example uses with Object Facade classes SINCE 4.1.12

Below are some examples of how Insight/Asset objects values can be extracted within Velocity.

Display ObjectId for all connections made to a specific issue

This example will find all of the objects that have been referenced within the issue and will show the Object id’s for each connection.

#if($objectFacade.findObjectTicketConnections($issue.getId())) #set($connections = $objectFacade.findObjectTicketConnections($issue.getId())) #foreach($item in $connections) <p>Object Name and Key: $objectFacade.loadObjectBean($item.getObjectId())</p> #end #end

Output:

Object Name and Key: Object Name (Key)

Find a value of a specific attribute

This example will find the value of a specific object attribute.

#if ($objectFacade.findObjectTicketConnections($issue.getId())) #set($attribute = $objectFacade.loadObjectAttributeBean($objectFacade.findObjectTicketConnections($issue.getId()).get(0).getObjectId(), "Regex").getObjectAttributeValueBeans()) #foreach ($value in $attribute) <p>Attribute value: $value.getValue()</p> #end #end

Output:

Gathering a value from a specific attribute within a object selected on a Custom Field

This example will gather the objects found within a specific Insight/Asset field and will then compare against made connections on the issue and if matched it will then find the relevant attribute value within that matched object.

Output:

 

Example uses with Object Type Facade class SINCE 4.1.29

Find object type for all object connections made to a specific issue

This example will find the object type for each object that has been referenced within the issue

Output:

 

Example uses with Object Schema class since 4.1.29

Find all object schemas

This example will find the name of all object schemas that are configured within Jira.

Output: