It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Auto-Description overwriting on field change Edited

Alan Lavery Apr 04, 2017


We're currently using Behaviours to create template descriptions for various projects. Whenever we are creating an issue, edit the description field and then change another field the description resets to the template.

The issue also occurs if the form is submitted but the user has left out a required field. When the form reloads the changed text is still there but then resets to the template almost instantly.

We have included the suggested underlyingIssue? code from the documentation in the Initializer Script:

def desc = getFieldById("description")

def defaultValue = """Description
Template""".replaceAll(/ /, '')

if (! underlyingIssue?.description) {

Has anyone had this issue before and figured out a fix or could point me in the correct direction?


4 answers

1 accepted

1 vote
Answer accepted

Hello Alan.

As I understand you have two parts to your issue:

Part A: the form calls the initializer on the field in the behaviour when you change another field:

Part B: When the form is wrongly entered, such as when there is a required field missing, it calls the initializer again.

For Part A:

(the first import statement is to make sure that the DESCRIPTOR field works)


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

def desc = getFieldById(DESCRIPTION)

def defaultValue = """Description
Template""".replaceAll(/ /, '')

if (!desc.getValue()) {

This should do the trick. “underlyingIssue” calls the value of the issue object, which you have not created yet, because the form is not summited. So that is why it always sets it up to null.

The desc.getValue accesses the data in the form, rather than in the object. I tested it and it works on my environment, give it a try and tell us how it goes.

For part B if the behaviour is an initializer, it does behave as you say. However, if rather than setting up an initializer, you set up a field behaviour, then it should work as you expect, and even if you switch from different types of issues, you data should remain.

I hope this helps and if you need anything else don’t hesitate to ask.


Alan Lavery Apr 05, 2017

Hey D'Yelamos,

Big thanks for your help. The solution you posted works when I put the script into the Description behaviour field. 

I am stuck on one last part of issue which is when the create issue is being made in a new window (not the pop up lightbox window) the description template isn't populated on load. Does this screen need to use the Initaliser Function in order to populate?

Hello Alan.

I can verify that it is as you state and this has been added as a bug in the ScriptRunner log. Thanks very much.

You can access the issue in the link below to check its status.

It will be resolved in future releases.


Alan Lavery Apr 05, 2017

Thank's for that Daniel. I'll keep an eye on the bug for when it's fixed.

Alan Lavery Apr 06, 2017 • edited

Hey Daniel,

I have encountered another issue with this fix. Using the script above if we have different templates for a Story and a Bug on the same project when switching between issue types the template won't change.

Is there a way to check for IssueType or Project change?

If by change you mean that it does not get reset, then yes, it won't. That happens because it is a field behavior. If you want a reset on every form change, you should change the field behavior to an initializer. 
Please tell me if this helped.


Alan Lavery Apr 12, 2017

Unfortunately we can't use the Initializer to change the description due to the initial issue described above. If we use the Initializer to change the decription field it will reset whenever we change another field or reset if submitting with a missing required field.

It appears that we will have to decide on which issue we can live with unless we can determain when the issuetype or project field changes.

0 votes
Daniel Yelamos [Adaptavist] Apr 04, 2017 • edited Apr 05, 2017


0 votes
Daniel Yelamos [Adaptavist] Apr 04, 2017 • edited Apr 05, 2017

Did this solve your issue?

0 votes
Daniel Yelamos [Adaptavist] Apr 04, 2017 • edited Apr 05, 2017


Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Jira

Try Jira Cloud for Outlook: Organize your work without leaving your inbox

Hi Atlassian community, My name is Max and I work on the product integration team at Atlassian. I am pleased to announce the early access program for the Jira Cloud add-in for Outlook. This add-in...

2,398 views 6 15
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you