Scriptrunner behavior default text and validation error resets field completely

We are using the scriptrunner behavior plugin to set the default text of the description (so that the user has a template to fill out) when opening the create issue screen. Everything works as expected, however an issue we are facing is the scenario when a validation error occurs when clicking "Create" in the dialog.

The validation error gets displayed however the description is set to the default text again, losing all previously entered information.

The code we are using is the following:

import com.atlassian.jira.component.ComponentAccessor

import static com.atlassian.jira.issue.IssueFieldConstants.*

if (getActionName() != "Create Issue") {

def desc = getFieldById("description")

def defaultValue = "SOME DEFAULT VALUE''


1 answer

1 accepted

Are you using an Initializer function? If you are, I would instead create a behavior directly on the Description field with a script similar to this:

def desc = getFieldById("description")

def defaultValue="Your Default"


Thanks for the answer, but how do I create a behavior directly on the description field?

I tried this by "Adding" the description field to the behavior and then adding a server side script with the snippet you provided. However this does unfortuantly not work.

Ok, I figured it out. I forgot to set a condition when this script should be run.


How did you do it? I have same situation..

I added a condition that the script should only be run when the workflow step is "Create issue" (the first workflow step in my workflow).

Is your validation in the behaviors plugin or in the field configuration? It still did not work for me. I still get my fields reset when validatioin fails during create issue (e.g. missing component, required in field configuration)


  • Add behaviour (name it)
  • Click "Fields" in newly created behaviour
  • Select your Guide Workflow
  • Add the description field to the relevant fields
  • Add the server side script
  • def desc = getFieldById("description")
    def defaultValue = "SOME TEXT HERE"
    if (!desc.getValue()) { 
  • add condition:
    • when "workflow action" - select your action

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in Marketplace Apps

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,438 views 0 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you