Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira Scriptrunner Select List Conversions how to get the current selected value in behaviour

Stefan Bärthlein January 8, 2019

Hi there,

how can I get the current value of an custom field beeing converted to a single select by an scriptrunner behaviour eg.?

getFieldById("customfield_11002").convertToSingleSelect(...)

 The selectbox is successfully renderd in the transition form. If the selection changes (like client JavaScript OnChange) I want to react on the new selection and set the values of the remaining form (custom) fields regarding to some logic (similar to cascading selectboxes).

Is this possible using behaviours?

I've tried something similar to this which is for sure only giving my the "serverside" value, saved for the issue, not the current selected value (clientside)

 

import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.Issue
@BaseScript FieldBehaviours fieldBehaviours

// Den Wert der Custom Field Selectbox auslesen
def customFieldManager          = ComponentAccessor.getCustomFieldManager()
def vorgangstypSelect           = customFieldManager.getCustomFieldObject(getFieldChanged())
def vorgangstypValue            = underlyingIssue.getCustomFieldValue(vorgangstypSelect) as String
log.error "### vorgangstypValue: " + vorgangstypValue

If not am I able to inject some JavaScript using ScriptRunner?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events