Unable to clear default field value - ScriptRunner Behaviours

Raynard Rhodes
Contributor
June 8, 2020

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
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!
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