I use ScriptRunner and want to autofill the description field with some text - but only for issuetype "Bug".
So I followed this tutorial: https://scriptrunner.adaptavist.com/latest/jira/behaviours-overview.html
But therefore I get the following problem:
- create new issue
- "Bug" was default value, so I do have the expected prefilled text in description field
- I don't want to create a "Bug", so I switch to "Task"
- description field doesn't get cleared
So I created a 2nd "Behaviour" for all issue types except "Bug":
def desc = getFieldById("description")
desc.setFormValue("")- This cleared my description field when I change from "Bug" to "Task"
- but when I entered a usefull description and then change my mind to change issue type from "Task" to "Story", the description gets cleared again (but I want to keep it!)
So I need a condition before clearing the description field:
- clear it only if description contains the defaul text from my "Bug" behaviour
I'm not sure how to do this, especially because desc.getValue() always return "null" - regardless if it contains text or not.