Greetings -
I am having an issue creating a script in Behaviours that allows me to pass the pulldown list selected item to my new task I create under the same issue. See illustration below. Custom Field name is Accounting Category (its default is TBD) - I want to pass the Operating Expense choice.
Here is the screen shot of the behaviour set up.

Here is the full script
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.option.LazyLoadedOption
def accountingCategory = getFieldById(getFieldChanged())
def accountingCategoryValue = accountingCategory.value
if (!accountingCategoryValue){
return
}
def accountingCategoryIssueKey = accountingCategoryValue.toString().tokenize(":").last()
def accountingCategoryIssue = ComponentAccessor.issueManager.getIssueByCurrentKey(accountingCategoryIssueKey)
def selectListCustomField = ComponentAccessor.customFieldManager.getCustomFieldObjects(accountingCategoryIssue).findByName("Accounting Category")
// could not find custom field with name "Accounting Category" on the accounting issue - do nothing
if (!selectListCustomField) {
return
}
def selectListValue = (accountingCategoryIssue.getCustomFieldValue(selectListCustomField) as LazyLoadedOption)?.value
def optionId = ComponentAccessor.optionsManager.getOptions(selectListCustomField.getRelevantConfig(accountingCategoryIssue)).find { it.value == selectListValue}?.optionId
getFieldByName("Accounting Category").setFormValue(optionId)
any help would be greatly appreciated.