Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Custom field validation - how to get an issue instance?

grundic
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.
May 27, 2012

Hello!

I'm developing new Custom Field for our company.

I would like to check other issue fields/value in validateFromParams method. But the problem is that there is no instance of issue in this method. I've looked up in stack call and there is an issue instance in validateParams() of CustomFieldImpl class.

How can I get issue instance or validate my custom field on other issue's fields? I would like to make validation on issue create and update.

5 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
grundic
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.
May 27, 2012

I think, I found a solution.

I've created global loop transition in my workflow and assotiated a new screen with only my custom field. For this transition I wrote a validator, which can check everything I need.

0 votes
EddieW
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.
March 24, 2014

Users of JIRA 6.2.1 and above can get this from relevantParams.

@Override
	public void validateFromParams(CustomFieldParams relevantParams,
	        ErrorCollection errorCollectionToAddTo, FieldConfig config) {

		Issue passedIssue = (Issue) relevantParams.getFirstValueForKey(ISSUE_KEY);  //ISSUE_KEY = "issue"

0 votes
EddieW
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.
March 23, 2014
0 votes
grundic
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.
May 27, 2012

Yes, I would like to check other issue's fields and throw an error in some case.

0 votes
Mizan
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.
May 27, 2012

Are you trying to set the value of your customfield based on other issue fields ?

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events