The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Behavior does not run with inline edit

Pierre Ibrahim
Contributor
October 20, 2022

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)
The behavior works great if I click on the Edit button, however if I try to utilize the inline edit, the behavior doesn't work. I need to click the edit button and then save (even without changing anything, so it almost seems like it DOES work, but does not commit the change).
For reference, below is my behavior script:
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?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 20, 2022

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.

TAGS
AUG Leaders

Atlassian Community Events