createOption

    Signature

    Signature

    createOption(Issue issue,String customFieldName, String optionName)
    createOption(Issue issue, Long customFieldId, String optionName)

    Description

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

    If the option doesn't exist, creates and retrieves it.

    Introduced in 5.x

    Example use

    Use this method to create an option in a select list in case it does not exist.

    issue.customFields."Mood"?.value = nodeHelper.createOption(issue, "Mood", replica.customFields."Mood"?.value?.value)

    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.createOption(issue, 10201L, replica.customFields."Remote Select List CF Id"?.value?.value)