Good day.
I am writing a numerical custom field (it extends NumberCFType class) and I need to obtain an instance of the current issue on witch the custom field is being edited/created. I have been searching on the forum, the past couple of days, and have not found any solution to this problem. In some cases I can use the <<getVelocityParameters>> overriden method, to get the issue instance(in create/update screen), but in the view screen this method is not invoked(I belive). Any sugestion is more than welcomed.
Hello Laurentiu Nicolae,
as your NumberCFType extends AbstractSingleFieldType, you can access its methods.
public class NumberCFType extends AbstractSingleFieldType<Double>
Use the function getValueFromIssue and replace T with Double for your case and return some Double value e.g.: 1.0.
public T getValueFromIssue(CustomField field, Issue issue)
Example:
public Double getValueFromIssue(CustomField field, Issue issue) { return 1.0; }
The function getValueFromIssue should be called every time the customfield is accessed via the jira UI. Therefore you should always get the current Issue as the variable issue.
Kind regards,
Johannes
Thank you kindly for your answer, your answer is right on the spot. Actually I needed to do this for a certain scenario that needed to modify the value of that particular custom field, to all the issues of a certain type in a project. For that I used a listener to retrieve the necessary information on certain operations(Create/Update and Delete).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.