Hi.
I am new to scriptrunner but I am trying to make a "simple" script and I hope that someone can guide me in the right direction.
I have a custom field (Combo) where the user has to choose between some values. Empty, template1 and template2
When the field changes to template1 the issues description field changes its value to some predefined text etc.
After the change the user should be able to edit the field with additional values.
I believe that I should make it as a behavior on the Template field.
I have broken down the script to these steps
1. Trigger when the combo changes
2. Read the value from the combo
3. Change the text in the description field.
Step one seems to happen by it self
Step two I have some code (dosn't work)
import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueInputParametersImpl
import org.apache.log4j.Level
import org.apache.log4j.Logger
def log = Logger.getLogger("Template logging")
log.setLevel(Level.DEBUG)
log.debug "Script started"
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def TemplateCf = customFieldManager.getCustomFieldObjectByName("Template")
log.debug "template:" + TemplateCf
The debug TemplateCf gives the name of the field, it seems. I need the value.
Then I hope I, with a little help of if value=="Template1" then change the description field.
But can I change the field this way, and how?
Hope someone have the time to help me.
Best regards,
Jens