Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Behavior Script erroring out

Tony Rossiter
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 Leaders.
Apr 01, 2020

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
AUG Leaders

Atlassian Community Events