Forums

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

Behaviour- default value in options custom field- Can't update it

Dan27
Contributor
July 16, 2018

Hi,

I wrote this code:

import com.atlassian.jira.component.ComponentAccessor

// set a select list value -- also same for radio buttons
def Team = getFieldByName("WBL Agile Team");
def optionsManager = ComponentAccessor.getOptionsManager();
def customFieldManager = ComponentAccessor.getCustomFieldManager();
def customField = customFieldManager.getCustomFieldObject(Team.getFieldId());
def config = customField.getRelevantConfig(getIssueContext());
def options = optionsManager.getOptions(config);
def optionToSelect = options.find { it.value == "IDD" }
Team.setFormValue(optionToSelect.optionId);

 I would like to set default option while creating the issue.

It worked, but after creating the issue, I can't update this field from the issue screen (Inline edit disabled).

Do you know hoe can I fix it ?

Thanks

 

1 answer

1 accepted

0 votes
Answer accepted
Dan27
Contributor
July 16, 2018

An update- I add this line and it fixed it: 

if (getAction()?.id != 1) {
return // not the initial action, so don't set default values
}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events