The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

How to create a custom field type whose value depends on another custom field?

Ganesh Gembali
February 21, 2012

Hi,

I want to have a simple custom field which is like a flag true | flase. It should calculate its value based on value of other custom fields.

I am able to do this using following code :

Object soSignoff = arg1.getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_10226"));
		Object pdSignoff = arg1.getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_10224"));
		return (soSignoff != null && pdSignoff!=null)? "Approved" : "Not Approved";

But one problem with above code is hardcoded ids of custom fields. I want it to be more generic so that in different projects/contexts I should be able to provide set of custom fields based on which it should calculate the value.

Note : I haven't tested above code yet.

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Radek Kantor
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 Champions.
February 21, 2012

Hi,

information about adding configuration to custom field is in Practical JIRA Plugins (O'Reilly, 2011). For quick (not so nice sollution) you can use default value or description fields.

TAGS
AUG Leaders

Atlassian Community Events