Forums

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

JMWE or some other tool maybe: Is it possible to forbid the value of one field to be the same?

Jurica Petricevic
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.
October 13, 2021

HI Community once again today,

because of the needs of one project, we want the value in the Key field to never be repeated.

Just to check the value during the entry and, if it already exists, to give an error in the entry. Is that somehow possible?

 

Best regards

Jurica Petricevic

2 answers

1 accepted

1 vote
Answer accepted
David Fischer
Community Champion
October 13, 2021

Hi @Jurica Petricevic 

you can use a Scripted (Groovy) Validator with one line of code that uses the jqlSearch global function. The exact code depends on the custom field type of the Key field. The biggest issue is if the field is a Text field, because by default Jira won't allow searching for an exact value in text fields (the "search template" associated with text fields only supports fuzzy searching using the ~ operator). Unless you also have JMCF, which offers an "Exact text searcher" search template you can use with standard Text fields.

Jurica Petricevic
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.
October 13, 2021

the problem is as following: The entire project mengement will be moved to Jira / Structure.

One field called Key, which is mandatory, is where the project manager defines the project key. It is not a Jira field nor will it ever be. This is a field that will always be entered manually but the value must never be repeated.

 

I have ScritpRunner, JMWE and Automation for Jira at my disposal.

David Fischer
Community Champion
October 14, 2021

@Jurica Petricevic they're must be a misunderstanding - any data you can input and associate to a Jira issue must be in a Jira custom field. So I assume the Key field will be a custom field. Right?

Jurica Petricevic
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.
October 15, 2021

yes, sure.

David Fischer
Community Champion
October 15, 2021

Then, as I mentioned, you can use a Scripted (Groovy) Validator with this code:

jqlSearch("ProjectKey ~ '${issue.get("ProjectKey")}'", 1).size() == 0

Where ProjectKey is the name of the field (of type single-line text) in which the user enters the key. You shouldn't call it "Key" because that field name is already used by Jira. 

Like Jurica Petricevic likes this
Jurica Petricevic
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.
October 18, 2021

@David Fischer Perfect.

0 votes
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.
October 13, 2021

The issue key (which is what we assume when people say "key" in Jira-speak) will always be unique.

If you mean you are talking about another key field of some sort, then no, you can't enforce this without doing a bit of coding that validates people aren't entering more of the same.

I'd question the need for this though.  What is your "key" field capturing?

Jurica Petricevic
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.
October 13, 2021

the problem is as following: The entire project mengement will be moved to Jira / Structure.

One field called Key, which is mandatory, is where the project manager defines the project key. It is not a Jira field nor will it ever be. This is a field that will always be entered manually but the value must never be repeated.

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.
October 14, 2021

I don't understand that.

If it's not going to be a Jira field, then there's no need to try to enforce uniqueness in Jira

Could you explain what this field is actually supposed to be capturing?

Jurica Petricevic
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.
October 15, 2021

PPRO - for 3Projects-Project

RREQ - for 3Request-Project

USTA - for 3Stay-Project

etc.

bold should always be unique and it is written by the project manager.

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.
October 15, 2021

Ok, but what actually is it the data for?  Why are you putting it in?  And where is it going into Jira if it's not a Jira field?

Suggest an answer

Log in or Sign up to answer