Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Using Behaviors to populate Description Field

Brian Taylor
Contributor
June 20, 2017

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

0 votes
Thanos Batagiannis [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 26, 2017

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

Brian Taylor
Contributor
June 27, 2017

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
TAGS
AUG Leaders

Atlassian Community Events