Forums

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

Option in a CustomField not set by transition

tobbk
Contributor
October 26, 2018

Hello,

I don't know why I can't set an option in a selectList by a transition.

def cf = customFieldManager.getCustomFieldObjectByName("MyField")
def cfConfig = cf.getRelevantConfig(linkedIssue)
def value = ComponentAccessor.optionsManager.getOptions(cfConfig)?.find { it.toString() == 'Option A' }

def
issueInputParameters = issueService.newIssueInputParameters()
issueInputParameters.with {
setResolutionId("2")
setComment("Test")
addCustomFieldValue(cf, value)
setSkipScreenCheck(true)
}

def validationResult = issueService.validateTransition(adminUser, linkedIssue.id, 111, issueInputParameters)
//Here is only Error exception

This transition is not in the same workflow where this script is running.
I want to change the Status of another issue with a different workflow. I have to set the customfield "MyField", because of a check if this Field has an selected option.

In another script I use instead of the validateTransition() the issue.setCustomfield(cf, value) mehtod and it works fine.

I also try to set the option before i fill the issueParameters.

Hope someone can help me.

Thanks a lot

1 answer

1 accepted

0 votes
Answer accepted
tobbk
Contributor
November 22, 2018

I found a Solution

addCustomFieldValue(cf.id, value.optionId as String)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events