Hi Guys,
Need one help in fixing the below issues.
I have applied a Script Runner on Description field for Bug issue type, when user click on Create button Default value add in system Description field. In Default value, user there value as well and click create issue.
When user click on Edit button, Default description set via Behaviour replace the existing value of Description. How can i fix this, so that when user click on Edit button existing value doesn't change nor apply Default description value.
Want to apply Behaviour only on Create screen.
From your description, it appears that you need to include the condition
if (!underlyingIssue?.description) {
desc.setFormValue(value)
}
This is so that it will take effect only on the Issue creation screen and not on the Issue update screen, as shown in the Adaptavist Documentation.
It would be good if you could share your code so I can better understand what you are currently doing.
Thank you and Kind regards,
Ram
Hi @Ram Kumar Aravindakshan _Adaptavist_ Thanks for your help as always.
It's working fine now, not editing existing value when clicking on Edit button.
Kindly correct my code, if anything wrong in my code. Following is working for Bug and Bug Subtask.
import com.atlassian.jira.issue.*
def description = getFieldById("description")
def issuetype = getIssueContext().getIssueType().name
if (issuetype.contains("Bug") || issuetype.contains("Bug sub-task")){
if (!underlyingIssue?.description){
description.setFormValue("""h3.Description
_<Explain the observations as clear as possible>_
*Steps to reproduce*
_<-- minimum steps that describe the entire path of reproducing the bug._
_-- Describe one step per line>_
*Expected result*
_<Describe the expected result according to the technical task, design, test cases outcome>_
*Actual result*
_<Explain the current observation as clear as possible>_
*Attachments (screenshots, files, error log etc)*
_-- Screenshot (it's convenient when the bug is highlighted with a circle or an arrow),_
_-- Files (Uploaded files)_
_-- Error logs_
h4.NOTE (optional)
_-- Any other observations_""")
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You may want to clean up your code a little. You should update it to:-
import com.atlassian.jira.issue.*
def description = getFieldById("description")
def issuetype = issueContext.issueType.name
if(!underlyingIssue.description && issuetype in ['Bug', 'Bug sub-task'] ) {
description.setFormValue("""h3.Description
_<Explain the observations as clear as possible>_
*Steps to reproduce*
_<-- minimum steps that describe the entire path of reproducing the bug._
_-- Describe one step per line>_
*Expected result*
_<Describe the expected result according to the technical task, design, test cases outcome>_
*Actual result*
_<Explain the current observation as clear as possible>_
*Attachments (screenshots, files, error log etc)*
_-- Screenshot (it's convenient when the bug is highlighted with a circle or an arrow),_
_-- Files (Uploaded files)_
_-- Error logs_
h4.NOTE (optional)
_-- Any other observations_""")
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.