Determining how to render certain Custom Fields

Hey Community,

I am currently working on a JIRA export Plug-In and was wondering if there is any good way to find out how to display a custom Field.

I could just use switch case or if statements to check for the Field Types, but that would probably stop working once Custom Fields from other Plug-Ins come in to the mix.

So is there any way to maybe get the Custom Field to tell you how it wants to be displayed ?

Thanks in Advance
Felix

Hi Felix,

I do it like this:

            Object value = customField.getValue(issue);
            if (value != null) {
                FieldLayoutItem fieldLayoutItem = fieldLayoutManager
                        .getFieldLayout(issue.getProjectObject(), issueType.getId())
                        .getFieldLayoutItem(groupByFieldID);
                if (fieldLayoutItem != null) {
                    fieldValue = customField.getViewHtml(fieldLayoutItem, null, issue);
                } else {
                    fieldValue = "";
                }
        }

Thank you.

1 Like

Thank you azhdanov,

this works pretty grate.