Using Behaviors to populate Description Field Edited

Using Behaviors and code that is on Scriptrunner site

 

Script Code.png

 

User are experiencing from time to time when they make changes the text reverts back tpo the default that is being set.  There have been reports that when a user clicks into another field the Description field reset to the defautl text.  Looking for posible causes or maybe something in the code. 

 

Additonal testing it appears that if you make the change to the default and then go to the Assignee field and set the assignee the field goes back to default value - but if you click the undo arrows in the lower right of the field and select undo - your changes are back. 

1 answer

Hi Brian,

Is this an initialiser function ?

I would suggest to change it into 

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

def desc = getFieldById(DESCRIPTION)

if (! desc.getValue() ) {
    desc.setFormValue("This is a default value")
}

regards, Thanos

This did fix the issue on creating an issue that it does nto revert back to the original text.  However there are two new issues that cropped up 

  • If you edit an issue the defualt text overwrites the exisitng text 
  • With the behavior enabled it disables the ability to edit the descriotion in the Issue Detail view on a board. 

 

This is hte code that I have in place 

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


def desc = getFieldById(DESCRIPTION)

if (! desc.getValue() ) { desc.setFormValue("""h2. Narrative
* As a
* I want
* so that

h2. Acceptance Criteria
Enter the Acceptance Criteria here.""") }

Suggest an answer

Log in or Sign up to answer
Community showcase
Published yesterday in Jira Ops

Jira Ops Early Access Program Update #2: Let’s talk severity levels

Welcome to your weekly Jira Ops Early access program update, where we’re sharing news and updates on Jira Ops' progress as we work toward our 1.0 release. If you ever want to drop us feedback or idea...

24 views 0 0
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