Why is Behaviours script not triggered after inline edit?

I have written a Behaviours script that triggers and functions correctly when I use the Edit form and change the Due Date field.  However, when I do an inline edit of the Due Date field, the script does not seem to be triggered.  Any help would be appreciated.

import java.util.Date
import java.sql.Timestamp
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.fields.config.FieldConfig
import com.atlassian.jira.issue.customfields.option.Options
import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import org.apache.log4j.Logger
import org.apache.log4j.Level
Logger log = Logger.getLogger("com.tripadvisor.groovy")
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
OptionsManager optionsManager = ComponentAccessor.getOptionsManager()
if (underlyingIssue != null)
    FormField dueDateFormField = getFieldById(fieldChanged)
    FormField isLateFormField = getFieldByName("Is Late")
    Timestamp originalDueDate = underlyingIssue.getDueDate()
    if (originalDueDate == (Object) null)
        // log.debug "originalDueDate is null"        
        log.debug "originalDueDate: " + originalDueDate
        Date now = new Date()
        log.debug "now: " + now
        int daysUntilDue = originalDueDate - now
        log.debug "daysUntilDue: " + daysUntilDue
        if (daysUntilDue < 1)
            // Set Is Late custom field value to "Yes"
            CustomField isLateCustomField = customFieldManager.getCustomFieldObject(isLateFormField.getFieldId())
            FieldConfig isLateConfig = isLateCustomField.getRelevantConfig(getIssueContext())
            Options allIsLateOptions = optionsManager.getOptions(isLateConfig)
            Collection relevantIsLateOptions = allIsLateOptions.findAll { it.value == "Yes" }
            // log.debug "relevantIsLateOptions: " + relevantIsLateOptions
            Collection<String> isLateKeys = relevantIsLateOptions.collect { it.optionId.toString() } 

2 answers

Hi Neil,

Behaviours only works on the Create and Edit screens for an issue. Inside Newer versions of Script Runner then Inline editing is automatically disabled when a behaviour is added to a field.

For older versions as a workaround you can look to use JavaScript to disable in-line editing as described in the question here.

I hope this helps.



It seems (based on an old answer) that inline editing should be disabled for this field, but it is not.  I am using OS X 10.10.5 and Chrome Version 47.0.2526.106 (64-bit).  The same applies to Mac Firefox 42.0.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Apr 19, 2018 in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

366 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you