Forums

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

Unable to clear default field value - ScriptRunner Behaviours

Raynard Rhodes
Contributor
June 8, 2020 edited

I can set the default value for the description field but I'm unable to clear it.

 

def desc = getFieldById("description")
def issueType = getFieldById("issuetype")


def defaultValue = """Who: user/role


What: description of a feature / workflow / action

Why: benefit / value / reason




Note: Please provide screenshots, mockups, photos of whiteboards, sample files, etc. to better present what needs to be done within the scope of a ticket.







Analysis (Technical) Notes:

Developers provide technical details on implementation, references, code, links, screenshots, etc. here""".replaceAll(/ /, '')

if (! underlyingIssue?.description) {
if(issueContext.issueType.name == "Epic")
desc.setFormValue(defaultValue)
}else if(underlyingIssue?.description == defaultValue && issueContext.issueType.name != "Epic"){
desc.setFormValue("Test")
}

This message also pops up

These fields have default values for this project and issue type combination. We have preserved the existing values in case you need them.

2 answers

1 accepted

2 votes
Answer accepted
Raynard Rhodes
Contributor
June 8, 2020

The issue is that I choose issue types in the mapping. I just defined the issuetypes in the if condition

1 vote
Tiago Miguel Sousa Santos April 21, 2022

I had such a similar Warning but I solved my problem by adding a space between my * and to all occurrences

Previously my default Description was:

*Story Description*:

then changed it to

*Story Description* :

 Tiago

Robert Leachman
Contributor
August 23, 2022

So weird, my field did not have a description so I added it with a space at the end and the message went away... and then I cleared the description.

Now it displays exactly the same way as before but with no warning. Rather feels like a bug but I suppose too much of a corner case to get any attention.

Thanks for the clue!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
Atlassian, Team '25 Europe, Atlassian conference, AI-powered teamwork, Atlassian events, keynote speakers, Barcelona tech conference, Atlassian Williams Racing, Carlos Sainz, Jenson Button, Mike Cannon-Brookes, Anu Bharadwaj, Atlassian Rovo

Atlassian Williams Racing is coming to Team '25 Europe 🏎️

Discover the teamwork and precision behind success on and off the track. See how this high-performing team makes the impossible possible. Be one of the first 100 customers to register for a chance to win 2 tickets to an Atlassian Williams 2026 race.

Register now
AUG Leaders

Atlassian Community Events