I would like to automatically set the flagged(impediment) field using JIRA ScriptRunner Behaviours.
Below is my script:
def flagged = getFieldById("customfield_10100")
flagged.setFormValue(["Impediment"])
This does not seem to work and I am not getting errors either.
Please assist
Hello @Shawn Danisa
What type is flagged field? And where you put your script, initialiser or mapped to a field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you want to set Form value for selectlist or check box, you must provide option id.
Like this
import com.atlassian.jira.component.ComponentAccessor
def flagged = getFieldById("customfield_10100")
def optionsManager = ComponentAccessor.getOptionsManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObject(flagged.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
def optionToSelect = options.find { it.value == "Impediment" }
flagged.setFormValue(optionToSelect.optionId)
See scriptrunner documentation for more information
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.