Hello!
I'm having an issue with a behavior that looks at a checkbox custom field, and sets a single list picker custom field according to the values in the checkbox.
Originally this worked great but with no inline edit, so I added the following function to the initializer script to enable inline edit:
def checkBoxCF = getFieldById("customfield_FIELDID")
checkBoxCF .setAllowInlineEdit(true)
import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.component.ComponentAccessor
def checkBoxCF = getFieldById("customfield_FIELDID")
def fieldName = "CUSTOMFIELDNAME"
def selectListCF= getFieldById("customfield_FIELDID2")
def optionsManager = ComponentAccessor.getOptionsManager()
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName(fieldName)
def fieldConfig = customField.getRelevantConfig(getIssueContext())
def optionsSelectListCF = optionsManager.getOptions(fieldConfig)
def optionsCheckBoxCF = checkBoxCF .getValue()
//Multiple options
if(optionsCheckBoxCF instanceof List<Option> ){
if(optionsCheckBoxCF.contains("Value1") && optionsCheckBoxCF.contains("Value2") && optionsCheckBoxCF.contains("Value3") && optionsCheckBoxCF.contains("Value4")){
def option = optionsSelectListCFfind {it.value == "B1"}
selectListCF.setFormValue(option.optionId);
}
Question is, how can I have the inline edit work and update the select list correctly? Is there a way to have the script commit the change for a different field? Would I need a different behavior for the select list to commit if it's changed?
This is the expected behavior.
Behaviours can't execute based on In-line edits.
Historically, in-line edits were always disabled and attempting to in-line edit would cause the full edit screen to open so that the Behaviour logic could execute as expected.
The setAllowInlineEdit was added at some point to bypass that default behavior for cases where the business wants to allow those changes despite the logic being bypassed.
If you look at this example: https://docs.adaptavist.com/sr4js/latest/features/behaviours/behaviours-examples/scripted-conditions
You can see that the inline edit is only enabled in the case of a user being an admin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.