Setting a Default Description

This simple example can be used as a tutorial.

  1. To create a new Behaviour. Go to the Administration screen, and click the Behaviours link in the Behaviours section, or press gg or . and type Behaviours.

  2. Enter a Name and Description for the new behaviour.
    new behaviour

  3. Click on Fields.
    click fields

  4. Click the Create Initialiser link.
    click create initialiser

  5. Enter the following in the Script section (leave the first two fields blank):

    def desc = getFieldById("description")
    
    def defaultValue = """h2. How to reproduce
        * step 1
        * step 2
    
        h2. Expected Result
    
        The widget should appear
    
        h2. Actual Result
    
        The widget doesn't appear""".replaceAll(/    /, '')
    
    if (!underlyingIssue?.description) { // <1>
        desc.setFormValue(defaultValue)
    }

  6. Click Update.

  7. Click the Add one now link to map this behaviour to a project.
    add mapping

  8. Select one or more projects, then click Add Mapping.
    create mapping
    This is a very simple configuration and should be used to check everything is working. For information about Jira Service Management mappings, see Behaviours with Service Management.

  9. Create a new issue in the project associated with this behaviour. You should see the default description.
    default desc results