<img height="1" width="1" style="display: none" src="https://www.facebook.com/tr?id=976470819114134&amp;ev=PageView&amp;noscript=1">

Adding Portfolio for Jira Team to dashboards



The Problem

Portfolio for Jira allows teams to plan their future pipeline of work effectively. While managing issues, project managers will often assign issues to teams. Unfortunately, these teams cannot be displayed in dashboard gadgets. The Portfolio for Jira 'Team' field is not a fully supported field. It cannot be added to agile boards, or to dashboard gadgets, to quickly answer questions such as, which team currently has the highest workload? Atlassian currently have this as an outstanding issue in their public backlog (JPOSERVER-1847).

One of our clients tasked us with finding out if anything could be done about the situation. Here's what we did.

The Solution

We set up a special custom field which drew information from the Portfolio teams field, allowing users to edit in information in only one place, yet having the best of both worlds - available in both Portfolio and in dashboard gadgets.

Marketplace apps

The following add-ons were used to enhance the functionality of the existing Team field:

Setup

  1. Login to Jira as an administrator.
  2. Open the administration menu > Issues.
  3. Find the custom field id of "Team" field and note this down. It is a five digit number.
  4. Open the administration menu > Add-ons.
  5. Choose "Script fields" in the left hand navigation menu.
  6. Choose Add New Item ยป > "Custom Script Field".



  7. Fill out all the relevant details.

  8. Add the following code for inline script:

    import com.atlassian.jira.component.ComponentAccessor
    
    def issueManager = ComponentAccessor.getIssueManager()
    def customFieldManager = ComponentAccessor.getCustomFieldManager()
    
    def teamPortfolio = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_12345")
    def teamValue = issue.getCustomFieldValue(teamPortfolio)
    
    if (teamValue) {
        return teamValue.getDescription().getTitle()    
    }
    
    return null

    You should end up with a configuration looking like this:



  9. Click Save.

  10. From the scripted fields screen, click the cog wheel next to 'Team' and configure Context.
    As scripted fields can be performance heavy, adding the field to all projects is not recommended. Best practice recommends restricting scripted fields to only necessary projects and issue types.
    We've tested this script at load with 300,000 issues, running Jira Data Center 7.3 on 3 nodes without any issue.


  11. Restrict the field to necessary issue types and projects only.




  12. Click Modify.
  13. Open the administration menu > Issues.
  14. Click "Custom fields" in the left hand navigation menu.
  15. Find the relevant field and click the cog wheel > Edit.




  16. Change the search template to "Exact Text Searcher (natural)".





  17. The configuration is now complete.
  18. To apply the changes, reindex the projects which are in scope/context.
  19. Once reindexing is complete, the new field is ready to use.


The Result

The 'Team' field is now available in gadgets:


and can be queried with JQL, like any other field:






If you're interested in learning more about how our team at GLiNTECH can help you take Portfolio for Jira to the next level, or scaling up your enterprise instance of Jira, don't hesitate to get in touch.