Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,467
Community Members
 
Community Events
165
Community Groups

Script Runner Behaviours replace existing value of Description field when click on Edit button

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. 

 

@Ram Kumar Aravindakshan _Adaptavist_ 

1 answer

1 accepted

3 votes
Answer accepted

Hi @Vikrant Yadav

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_""")

}

}

Suggest an answer

Log in or Sign up to answer
TAGS

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