Questions about Behaviour to set default description value?

catheline
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 23, 2019

Hi Team,

 

We have set the below code as default description for Improvement issue type for a Project with many issue types.

def desc = getFieldById("description")

def defaultValue = """Required functionality / Needed changes:
<describe what is needed and expected behavior>
Reason for request:
<describe why it is needed (benefit if implemented / impact if not implemented)>
""".replaceAll(/ /, '')

if (!underlyingIssue?.description) {
desc.setFormValue(defaultValue)
}

The behaviour works fine if we try to create new issue in new tab/window but if we create or change the issue type other than "Improvement" in the same form then the default behaviour still shows.

 

Behaviour is set just for Improvement Issue type.

 

Let us know your suggestions.

 

Thanks!

1 answer

0 votes
Carmen Creswell [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.
January 23, 2019

Hi Catheline,

My guess is that you have this Behaviour on the Description field. You should put this Behaviour on the Issue Type field instead of the Description field so that it will run the Behaviour every time the Issue Type field is updated. You should also change the Mapping to All Issue Types instead of just "Bug" and use this slightly modified code instead: 

def desc = getFieldById("description")

def defaultValue = """Required functionality / Needed changes:
<describe what is needed and expected behavior>
Reason for request:
<describe why it is needed (benefit if implemented / impact if not implemented)>
""".replaceAll(/ /, '')

def issueType = getIssueContext().getIssueType().name

if
(issueType == "Bug") {
if (!underlyingIssue?.description) {
desc.setFormValue(defaultValue)
}
} else {
desc.setFormValue(" ")
}
catheline
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 23, 2019

Hi Carmen,

Thank you for the inputs, we will try and let you know.

Also, we want this default only for the create Issue form not for Edit Issue.

Please let us know what we should do for this.

Thank you,

Catheline

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events