Jira Plugin Renderer - Get Renderer for Customfield

Hey there,

I have a Velocity where the User have to select some default values for Issue which will be generated via e-mail. (the plugin is actually a message handler plugin)

The last select field contains all fields which are configured for given project and the selected issuetype. The user should select a field and define a default value. If the user select the field and click the button on the right a servlet will provide the correct renderer

I pass to my serlvet the projectId, issuetypeId, and the selected customfieldId. My function looks like this:

            final String issueTypeId = req.getParameter("issueTypeId");
            final String projectId = req.getParameter("projectId");
            final String customFieldId = req.getParameter("customFieldId");
            final Map<String, String> rendererParams = new HashMap<String, String>();

            final CustomField field = customFieldManager.getCustomFieldObject(customFieldId);

            final FieldLayout fieldLayout = fieldLayoutManager.getFieldLayout(
                    Long.valueOf(projectId),
                    issueTypeId);

            final String rendererTypeForField = fieldLayout.getRendererTypeForField(field.getId());

            final JiraRendererPlugin rendererForType = rendererManager.getRendererForType(
                    rendererTypeForField);

            final String editVM = rendererForType.getDescriptor().getEditVM("",
                    null,
                    rendererTypeForField,
                    field.getId(),
                    field.getFieldName(),
                    rendererParams,
                    false);
 

No matter what type of customfield (datepicker, single-select, multi-select) I select, the fieldlayout will return “jira-text-renderer” and therefore I will always get for getEditVM a simple textarea like this

<textarea class="textarea long-field" id="customfield_10441" name="customfield_10441"></textarea>

How can I get the correct RendererType for a field?

1 Like