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

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 Leaders.
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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events