Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Behavior Script erroring out


We've been using a set of behavior scripts to tally up a set of single select list fields into one number field that then sets the value of another single select list field.  The purpose of this script is to assess the risk, impact, and visibility of a proposed change to a system and then assign an impact score from I1 to I4.  This script has been working for years now but recently stopped.  I suspect it had to do with a recent upgrade to new Scriptrunner version v.5.8.0-p5

Here is the initializer script: 

* @version 1.0
* This is the initialiser script to set the CMR Categorizarion Total field to 0.

def totalField = getFieldById("customfield_10195")

 and here is one of the field-level scripts:

* @version 1.0
* The validation script that performs the capturing of field values and performing calculations for the total field
* This scrpt focuses on the CMR Categorization - Back Out Effort field

// declare the field that will constantly change
def backOutEffort = getFieldById(getFieldChanged())

// declare other fields
def businessProcessChange = getFieldById("customfield_10212")
def changeExperience = getFieldById("customfield_10215")
def degreeOfVisibility = getFieldById("customfield_10214")
def systemImpact = getFieldById("customfield_10210")
def organizationalVisibility = getFieldById("customfield_10208")
def scopeOfChange = getFieldById("customfield_10213")
def totalField = getFieldById("customfield_10195")
def impactScoreField = getFieldById("customfield_10222")

def currentFieldValue = totalField.getValue().toString()
def total = Integer.valueOf(currentFieldValue)

// perform calculation here
total = backOutEffort.getValue() != null ? Integer.valueOf(backOutEffort.getValue().toString()) : 0
total += businessProcessChange.getValue() != null ? Integer.valueOf(businessProcessChange.getValue().toString()) : 0
total += changeExperience.getValue() != null ? Integer.valueOf(changeExperience.getValue().toString()) : 0
total += degreeOfVisibility.getValue() != null ? Integer.valueOf(degreeOfVisibility.getValue().toString()) : 0
total += systemImpact.getValue() != null ? Integer.valueOf(systemImpact.getValue().toString()) : 0
total += organizationalVisibility.getValue() != null ? Integer.valueOf(organizationalVisibility.getValue().toString()) : 0
total += scopeOfChange.getValue() != null ? Integer.valueOf(scopeOfChange.getValue().toString()) : 0

// set the total field value to what's been calculated
log.debug "Current total value is ${totalField.getValue()}"

if (total >= 7 && total <= 11) {
log.debug "Total: ${total}; Impact Score: I4"

} else if (total >= 12 && total <= 17) {
log.debug "Total: ${total}; Impact Score: I3"

} else if (total >= 18 && total <= 23) {
log.debug "Total: ${total}; Impact Score: I2"

} else if (total >= 24) {
log.debug "Total: ${total}; Impact Score: I1"

} else {
log.debug "Total: ${total}; Impact Score: None"

I'm getting the following errors in the atlassian-log file: 


2020-04-01 11:29:50,820 http-nio-80-exec-41 ERROR trossiter 689x1033025x1 1e2d0ov /rest/scriptrunner/behaviours/latest/runvalidator.json [c.o.jira.behaviours.BehaviourManagerImpl] *************************************************************************************

2020-04-01 11:29:50,820 http-nio-80-exec-41 ERROR trossiter 689x1033025x1 1e2d0ov /rest/scriptrunner/behaviours/latest/runvalidator.json [c.o.jira.behaviours.BehaviourManagerImpl] Script function failed on issue: (create issue) project/issuetype: CMR/CMR Standard, user: trossiter, fieldId: customfield_10213, file: <inline script>

Any help would be greatly appreciated. Thanks!

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence Cloud

🎨 Add some visual life to your templates

Hi Atlassian Community, My name is Avni Barman, and I am a Product Manager on the Confluence Cloud team. Based on feedback from you, we are giving admins more power to create templates that a...

183 views 3 8
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you