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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Implementing configurable customfields that respect customfield context

One of my mistakes while developing custom field was not to respect custom field context.

Assume we are implementing a Location custom field type and we want this custom field to be configurable (e.g. countries drop down).

We can design a servlet in which we can select the custom field and pick a country from the drop down. This would work when you create Location types custom fields which do not differ against custom field context.

As an example,

  • define UK Location custom field and select United Kingdom as the location.
  • define USA Location custom field and select United States as the location.

The code would be as below. It is getting customfieldId as the identifier.

LocationConfigItem config = locationService.getLocationConfig(customfieldId);

But if want to have only one location custom field, but differs based on custom field context?

  • define Location custom field
  • add context for UK issue types and select United Kingdom as the location
  • add context for USA issue types and select United States as the location

Our servlet would not work because it can be configured against custom field instead of custom field config context.

So, we should store fieldConfigId for the identifier in order to respect custom field contexts.

LocationConfigItem config = locationService.getLocationConfig(fieldConfigId);

We can obtain fieldConfigId by passing issue object to customfield's getRelevantConfig method as below

Long fieldConfigId = customField.getRelevantConfig(issue).getId();

This way, our configurable custom field type respects custom field contexts which means it can be configured per each context.

I hope I was clear, enjoy!




Log in or Sign up to comment
AUG Leaders

Atlassian Community Events