Forums

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

How do I filter issues by custom field and how do I make this field unique?

Daniel Tita August 13, 2021

How do I filter issues by custom field and how do I make this field unique?

My custom field is a simple integer

3 answers

2 accepted

1 vote
Answer accepted
Nic Brough -Adaptavist-
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.
August 13, 2021

>How do I filter issues by custom field

I think Callum answered this

>and how do I make this field unique?

I think you're asking to generate yet another unique identifier for an issue here, which sounds as simple as creating a number or string and making sure no other issue takes the same value as another.

You'll need to code to do this, with the minimum viable option being a validator that can search for the id entered by the human and tell them to bog off if they enter a duplicate.  More advanced ideas would be to generate a new unique one and then set it for them.  This is a bad thing to do, as it will not scale.  It'll work fine when you've got a few thousand issues, but do you really want to have to do a uniqueness check across a million issues on every create and edit?  Nope.

I strongly recommend you look again at the "need" for such a field.  It's redundant (Jira already has two issue ids that uniquely identify an issue with no need for the humans to do anything), it's less functional (you can build urls and quickly identify issues from one of the unique keys, amongst other things), and your humans are never going to use it in preference to the actual issue key. 

What problem are you trying to solve with this "unique" number?

0 votes
Answer accepted
Max Foerster - K15t
Community Champion
August 13, 2021

Hey @Daniel Tita ,

can you provide us with a little more context? Filtering issues using custom fields as a parameter is not different from other issues searches. (Little bit more on advanced searching especially with custom fields from the docs) 

What do you mean by "unique" in this context? Is the integer value only allowed to be used once in your project/instance?

Best, Max

Daniel Tita August 15, 2021

Thanks a lot Max. I need one issue to have one custom field that cannot be reused in another issue. How do I do that? And how do I pin my custom field as a column header that I can sort issues by

0 votes
Callum Carlile _Automation Consultants_
Community Champion
August 13, 2021

Hi @Daniel Tita ,

How are you wanting to filter your custom field? You can add parameters to a JQL search to filter based off the integer value, such as

customfield > 5 AND customfield < 100

 See more on how you can use JQL to filter here

Daniel Tita August 15, 2021

Thank you for that. I need my custom field to be added as a column header that I can click and sort the fields. Can I do that?

Callum Carlile _Automation Consultants_
Community Champion
August 16, 2021

Yes this is possible - if you are referring to a column in the search navigator, there is a 'columns' dropdown when you are on the advanced search view, where you can add your custom field as a column. By then clicking on the column name, it will toggle the order from ascending to descending.

The same thing can be done with a Jira Service Management queue, where you configure the columns when editing the queue

Like Kamiński, Bartłomiej likes this

Suggest an answer

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

Atlassian Community Events