Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting by Team

Margarita
Contributor
November 24, 2023

Is there a workaround for sorting by Team (locked Custom Field)?  

2 answers

2 accepted

1 vote
Answer accepted
Ste Wright
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 24, 2023

Hi @Margarita 

This isn't possible at present - although there is a feature request you can vote for, check out: JSWCLOUD-20787 

One workaround might be to...

  • Create a Custom Field to house the Team - either a text field, or a select list
  • Populate the field using Automation
  • Use that field to filter by instead

---

Text Field - Prerequisites:

Create a new field...

  • A short-text custom field to house this data
  • eg. Team (Text)

You also need the Team field's Custom Field's ID...

  • Go to Settings (cog icon in top-right) > Issues
  • Select Fields from the left-hand menu
  • Locate the Team field - and press the breadcrumbs (...) on the right-hand side of the row
  • Select View field information
  • The ID is in the URL - eg. customFieldId=10123

---

Text Field - Rule:

  • Trigger: Field Value Changed
    • Field to Monitor = Team
  • Condition: Advanced Compare Condition
    • First Value = {{issue.customfield_10123}}
    • Condition = does not equal
    • Second Value = <leave empty>
  • Action: Edit Issue
    • Field = Team (Text)
      • Value = {{issue.customfield_10123.name}}

---

Select List - Prerequisites:

The Select List option does require some additional setup, but is more static (as it's a field option not free text), and can be used in other places, like dashboards.

You're going to....

  • Note down the Team Custom Field ID...
    • Go to Settings (cog icon in top-right) > Issues
    • Select Fields from the left-hand menu
    • Locate the Team field - and press the breadcrumbs (...) on the right-hand side of the row
    • Select View field information
    • The ID is in the URL - eg. customFieldId=10123
  • Create a select list (single choice) custom field...
    • eg. Team (Select List)
    • List options which match your Team names
  • Note down the new field's Option's IDs...
    • Locate the new field in the Custom Fields list
    • Press the breadcrumbs (...) > Contexts and default value
    • Select the hyperlink Edit Options
    • Hover over each options' Edit hyperlink (in the Actions column), and note down each ID
      • The ID is at the end of the URL - eg. &selectedValue=10367
  • Note down the Team IDs...
    • Go to Teams (top navigation bar) > Search people and teams
    • Search for each Team and select it
    • The ID is in the URL - it's a long alphanumeric value - eg. team/705ed90q-6d7o-6h5h-j155-frj0ya45rg31-9

---

Select List - Rule:

  • Trigger: Field Value Changed
    • Field to Monitor = Team
  • Condition: Advanced Compare Condition
    • First Value = {{issue.customfield_10123}}
    • Condition = does not equal
    • Second Value = <leave empty>
  • Action: Create Lookup Table
    • Table Variable Name = teamSL
    • Table Entries:
      • Row 1 = 
        • Key = <insert Team ID>
        • Value = <insert corresponding Option ID>
      • ...add one Row per Team
  • Action: Edit Issue
    • Field = Team (Select List)
      • Value = {{teamSL.get(issue.customfield_10001.id)}}

---

Notes:

  • Once the data is populated into a field - you can then use it in your search query!
  • All the rules use IDs rather than field/team names. Whilst names might also work, the above rules are future-proofed from field/team name changes, or duplicate fields or team names being created.
  • The Select List is a bit more work, but it's going to be more static than a custom text field - so better for filtering, dashboards, etc.
  • The Select List option used a Lookup Table - you need one row per Team. The Lookup Table is a more efficient method of doing IF/ELSE without lots of additional rule components.
  • There's a range of smart values in use here.

---

Let us know what you think!

Ste

Margarita
Contributor
December 13, 2023

Hi Ste, 

This worked.  Thank you!   

Is there an easy way to backfill the old issues with the same field? 

Ste Wright
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2024

Hi @Margarita 

You should be able to use a Scheduled trigger to achieve backfilling.

For example...

  • Trigger: Scheduled
    • Run a JQL Query... = TRUE (checkbox)
      • JQL - "Team (New Field)" is EMPTY
    • Only include issues that have changed... = FALSE (checkbox)
  • ...rest of rule as above here

This should find all previous issues and populate them. You don't need to wait until the scheduled time - once the rule is created, you can immediately select "Run Rule" (which is in the breadcrumbs (...) menu in the new view) and it will run and complete.

Once done, you can either delete the rule, or just disable it.

Ste

Like Margarita likes this
0 votes
Answer accepted
Ryan M
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 24, 2023

Hi Margarita,

I'm going to assume you mean sorting while doing a JQL search?

The field itself doesn't support that, and unfortunately neither does Jira Automation. You can see a suggestion for this option has been made here already https://jira.atlassian.com/browse/JSWCLOUD-20787#:~:text=Summary,(ORDER%20BY%20Team%20ASC).  The only way I can think of off the top of my head would be a third party app from the marketplace that would allow you to create a field that references the value of the original Jira teams field, and populates itself with that value.

For example, a scripted field in the ScriptRunner app, where you would populate the value of the original teams field inside the scripted field, and use that field to sort when searching.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events