Skip to end of metadata
Go to start of metadata

We can use ScriptRunner scripts in order to work with the values of TFO's custom field types.

ScriptRunner scripts

What is the returned value, the original option name or its translation?

For example:

We have a Translated Dropdown List custom field with ID 10000

We add the following options and translations:

Option nameEnglish UKSpanish

We have an issue TEST-1 and we select the option "1" for our new translated custom field.

As an administrator, we create a new script like this:

import com.atlassian.jira.component.ComponentAccessor

The result of this script will be "1".

Therefore, the option name, without translate, will be returned.

Behavior scripts

What happens with Beahvior's scripts?

Besides the above configuration, we have a Single Line Text Field ("Text").

We create a new Behavior script like this:

def formFieldTFO = getFieldById(getFieldChanged())
def formFieldText = getFieldByName("Text")

Now open the edition or transition screen where this fields appear and change the selected value of the translated custom field.

We can see now the selected value into the text field. As we can see, the value returned by formFieldTFO.getValue() is the option name, without translate.

If we change the last line:

def formFieldTFO = getFieldById(getFieldChanged())
def formFieldText = getFieldByName("Text")

Now refresh the form and select another value. Now the returned value by formFieldTFO.getFormValue() is the option ID.

  • No labels