Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Use Groovy and the Insight-related classes to explore and drill down into an Insight field object attributes:

    Code Block
    def objectFacade = getComponent(com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade.class)
    def objId = issue.get("<custom_insight_field_id>").first().getInsightAttributeValue("<object_attribute>")
    objectFacade.loadObjectBean(objId)?.name
  2. As you can see in the recording below recording, we have managed to get the “Server Owner” attribute value (not just the id ID shown in this article's Problem section), even when it references another Insight object.

...

Info

The code snippet provided earlier can vary depending on the Insight object attribute type. For example, if we multiple values for an “Approvers” Insight object attribute that refers to a User’s property type from another Insight object (refer to the captures below), then the code snippet will look as follows:

Code Block
def objectFacade = getComponent(import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade.classObjectFacade
def objectFacade = getComponent(ObjectFacade)
def objIdobjIds = issue.get("<custom_insight_field_id>").first().getInsightAttributeValue("<object_main_attribute>")
def names_str = ""

def userManager = ComponentAccessor.getUserManager()
for (i in objIdobjIds) {
  def jiraUsrId = objectFacade.loadObjectBean(i).getInsightAttributeValue("<object_main_attribute>")
  names_str = names_str + ComponentAccessoruserManager.getUserManager().getUserByKey(jiraUsrId).displayName + " "
  i++
}
return names_str.trim()

...