Keep getting Property 'it' not found errors

Whenever I iterate over e.g. subtasks via subTasks.each { ... and then access some attribute of that subTask with e.g. it.key I keep getting "Property 'it' not found errors".

The code is definitively correct (e.g. copy&paste from examples), so something in the configuration must be wrong...

6 answers

1 accepted

Yes you are right - as soon as I changed all outputs of "... ${it.key}..." to "... " + it.key + " ... " it worked like a charm...

I need to base64 encode inline scripts, then this goes away.

Hi @Jamie Echlin [Adaptavist],

Perhaps good to mention/change this in the documentation?
And is the base64 encoding in scope for the foreseeable future?


The base64 encoding happened some releases ago. If you are having this problem now, with the latest version, please let us know. If that's the case possibly some fields were missed.

Hi Jamie,

I encountered the problem on version 4.3.9.
Will try the implementation again on version 4.3.12 


I'm getting 2 static type checking errors on the mentioned example, so this might be the problem as well. Did not encounter these on version 4.3.9 afaik.

Screen Shot 2016-10-23 at 18.38.59.pngScreen Shot 2016-10-23 at 18.39.04.png

The problem is that the type of "issue" cannot be inferred. How are you getting the issue? Can you give a screenshot that shows the context of how this is being run?

Hi Jamie,

This was a problem on my side. I tried to run it from Built-In Scripts instead of as a post-function.
When i insert it in the post-function it does not show any errors.
But when i execute the transition i still get the same error (Property 'It' not found).
The only thing i changed is the ="To Do" instead of 'Open' .

Do i need to make a reference to a certain transition ID? What's the 5 in your example? 



0 votes

I suspect your iterator is incorrect, or trying to loop over data you haven't really got.  I'd suggest posting your code here so we can see what it's trying to do.

The code is from and only slightly changed.

But as mentioned above - the problem is very unlikely in the code. I get the same results with other code snippets as well... 


import com.atlassian.jira.component.ComponentAccessor
def issueService = ComponentAccessor.getIssueService()
def user = ComponentAccessor.getJiraAuthenticationContext().getUser()
def subTasks = issue.getSubTaskObjects()
subTasks.each {
def issueInputParameters = issueService.newIssueInputParameters()
issueInputParameters.with {
setComment("*Transitioning* as a result of the *Transition* action being applied to the parent.")
// validate and transition subtask
def validationResult = issueService.validateTransition(user,, 5, issueInputParameters)
if (validationResult.isValid()) {
def issueResult = issueService.transition(user, validationResult)
if (! issueResult.isValid()) {
log.warn("Failed to transition subtask ${it.key}, errors: ${issueResult.errorCollection}")
} else {
log.warn("Could not transition subtask ${it.key}, errors: ${validationResult.errorCollection}")
0 votes

Mmm, I'm not sure about some bits of your code, but it looks to me like your use of "it" is correct and it should not be throwing errors. I think I'd poke this at Adaptavist's Script Runner team (I'll poke them too - I'm curious to know where I'm reading it wrong, I've recently asked for more exposure to scripting, and they're actively looking for questions like this too)

can you post the errors as well?

We're using ScriptRunner version 3.0.16 with JIRA 6.3 (we're due to upgrade soon) and trying to get Jamie's AddIssueToCurrentSprint.groovy script to run - see here:


However, we get the error "property activeSprint not found".


Assuming the problem revolves around changing "... ${it.key}..." to "... " + it.key + " ... ", please can someone suggest a re-worked version of the code below:


if (activeSprint) { "Adding issue $issue to ${}"     sprintIssueService.moveIssuesToSprint(loggedInUser, activeSprint, [issue] as Collection) } else { ("No active sprints were found for board: ${}") }


Many thanks


Either attach it as a file, rather than inline, or remove the and log.warn lines.

Or upgrade to the latest version, but you would also need to upgrade your JIRA. In later versions there is a built-in workflow function that does this.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Wednesday in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


163 views 0 4
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