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

How to fix syntax error on Groovy Jira post function containing it.label

In preparation for a Jira upgrade from 6.4.13 to 7.0.11, I am trying to remove all deprecation and error messages displayed in the post function groovy scripts, as recommended by ScriptRunner vendor Adaptavist.  The Script Runner plugin is being upgraded after the Jira upgrade from to

I am seeing this error in the version of Script Runner in Jira 7.0.11:

[Static Type Checking] No Such Property: label for class:  java.lang.Object

This is for it.label on the else if line of code.  What do I need to do to make that line of code compliant with the syntax checking?  


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.util.JiraUtils
import com.atlassian.jira.workflow.WorkflowTransitionUtil
import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl

import java.util.Properties

def log = org.apache.log4j.Category.getInstance('com.onresolve.jira.groovy.PostFunction')

def config = new Properties()
def configFile = new File("/usr/local/jira_app/scripts/config/${transientVars['pkey']}.properties")

config.load(new FileInputStream(configFile))

def customFieldManager = ComponentAccessor.getCustomFieldManager()

def applicableStepsField = customFieldManager.getCustomFieldObjectByName(config.getProperty('fields.steps'))
def applicableSteps = issue.getCustomFieldValue(applicableStepsField)

def actionId = transientVars['actionId']
def step = config.getProperty("actions.${actionId}.step")
def skipTo = config.getProperty("actions.${actionId}.skipTo")

if (!step || !skipTo) {
log.error("#skipUpgradeActionNotConfigured actionId: ${actionId}, step: ${step}, skipTo: ${skipTo}")
} else if (!applicableSteps?.any() { it.label == config.getProperty("steps.${step}") }) {"Skipping ${step} and transitioning to ${skipTo} on action ${actionId} for upgrade order ${issue}")

def workflowTransitionUtil = (WorkflowTransitionUtil) JiraUtils.loadComponent(WorkflowTransitionUtilImpl.class)




0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

How we use Jira Service Management for our recruitment process! - Part 2

It is never about setting up a process and being done with it. Rather, the focus should always be on optimizing it for the best outcomes. Thus, we didn’t stop at setting up JSM for our recruitment pr...

216 views 0 5
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