getOption

    Signature

    Helper nodeHelper
    Signature
    getOption(Issue issue,String customFieldName, String optionName)
    getOption(Issue issue, Long customFieldId, String optionName)
    Description

    Allows retrieving an option from a single select list custom field with the help of a custom field name or ID.

    Introduced in 0.8

    Example use

    def moodOption = nodeHelper.getOption(issue, "Mood", replica.customKeys.mood) 
    issue.customFields."Mood".value = moodOption

    Using the Custom Field Id instead of the Custom Field Name

    Set the received value from the remote select list custom field to the local custom field with ID 10201.

    // When you use field id add L at the end of the Id. E.g. 10201L is custom field id with L added at the end.
    issue.customFields."10201".value = nodeHelper.getOption(issue, 10201L, replica.customFields."Remote Select List CF Id".value.value)

    Comments

    • Options are available only for custom fields with values such as a select list, radio button or checkbox.

    When you use .value in a script, you'll get all option-related data.

    issue.customFields."Mood".value==`[[id:10, value:Happy], [id:11, value:Sneezy]]`

    When you use .value.value you'll get only the option value without additional data.

    issue.customFields."Mood".value.value==`[Happy, Sneezy]`