I'm trying to add about three templates for three issue types, such as the "Story", "Task" and "Bug" issue types. When the user selects Story it adds story template or Bug then Bug template. The following is my behavior script but it's not working.
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.scriptrunner.db.DatabaseUtil
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def issueType = getFieldById("issueType")
def desc = getFieldById("description")
def taskValue = """
h2. Please fill out the below form
* Team Name:
* Start Date:
*End Date:
* Project(s):
* Activities:
""".stripIndent()
def storyValue = """
h2. Please fill out the below form
* Server:
* Access
* Due Date:
* Job Perform:
""".stripIndent()
def bugValue = """
h2. Please fill out the below form
* Error Code:
* First Reported:
* Whoe Reported:
* Action Taken:
* Access Start Date:
* Estimated Resolution Date:
* Additional Info:
""".stripIndent()
if (issueType.value == "Task") {
desc.setFormValue(taskValue)
}
if (issueType.value == "Story") {
desc.setFormValue(storyValue)
}
if (issueType.value == "Bug") {
desc.setFormValue(bugValue)
}
It does not add a template to the description box. I know there is something wrong with the code but I couldn't figure it out.
Thank you for your help