Forums

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

Set or choose the field option (project picker) through script runner

felipe vaca
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 16, 2018

Hi guys,

Jira software - Server - Script Runner

By means of a post function of script runner, I am trying to establish or select the value of a custom field of type "Project picker", but I have not been successful.

 

def cfSelect = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("associated project")
def cfConfig = cfSelect.getRelevantConfig(issue)
def value = ComponentAccessor.optionsManager.getOptions(cfConfig)?.find {
it.toString() == 'Project XXX'
}
issue.setCustomFieldValue(cfSelect, value)


This code works perfectly with custom fields of type list, but not with custom fields of type "Project picker".

 

1 answer

1 vote
Jacek Jarzab
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 7, 2019

Hi, 
The solution is to set value like for a standard custom field (not select). But the value object should be of type com.atlassian.jira.project.Project
For example: 

issue.setCustomFieldValue(getCustomField(PROJECT_DELIVERY), sourceIssue.getProjectObject());

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events