How to add a default value to the Description field in Jira

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

    

Summary

Showing a pre-entered text in the Description field in Jira has been available since Jira 8.16 (release notes) through:

JRASERVER-4812 - Getting issue details... STATUS

For previous versions, this how-to provides a workaround to achieve this. It works for the three operations: issue creation, issue edition and inline edition (editing from the view screen).

Note this solution is different than setting a placeholder text, which is somewhat grayed out and gets substituted by what the user types in.


Environment

All versions of Jira from 4.x up to 8.x.


Solution

The solution consists of editing a .vm file and restarting Jira. Note this change will be overwritten at every Jira upgrade, so keep record of this to reapply the changes as needed.

  1. Locate and backup the file: WEB-INF/classes/templates/jira/issue/field/description-edit.vm

    The file should look something like this:
    #disable_html_escaping()
    #customControlHeader ($action $field.id $i18n.getText($field.nameKey) $fieldLayoutItem.required $displayParameters $auiparams)
    ## setup some additional parameters
    $!rendererParams.put("class", "long-field")
    $!rendererParams.put("rows", "12")
    $!rendererParams.put("wrap", "virtual")
    #if ($mentionable)
        $!rendererParams.put("mentionable", true)
        #if ($issue.project.key && $issue.project.key != "")
            $!rendererParams.put("data-projectkey", "$!issue.project.key")
        #end
        #if ($issue.key && $issue.key != "")
            $!rendererParams.put("data-issuekey", "$!issue.key")
        #end
    #end
    ## let the renderer display the edit component
    $rendererDescriptor.getEditVM($!description, $!issue.key, $!fieldLayoutItem.rendererType, $!field.id, $field.name, $rendererParams, false)
    #customControlFooter ($action $field.id $fieldLayoutItem.getFieldDescription() $displayParameters $auiparams)
  2. Edit it and add this code right before the "let the renderer display the edit component" line:

    #if(!$description || $description == '')
    #set ($description = 'Put stuff here: ...\\Use double backslashes for braking lines: ...\\ \\ And a pair of them for skipping a line: ... \\ \\ \\ And so on: ...')
    #end

    Change the 'Put stuff here: ...' by the default text you want to display.

  3. Save the file and restart Jira

The description should look like this, if the example text above is used:

Put stuff here: ...
Use double backslashes for braking lines: ...

And a pair of them for skipping a line: ...


And so on: ...



Last modified on Apr 29, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.