sourceIssue is undeclared - static type checking

Hi there, 

 

We recently updated to the latest version of JIRA and Script runner and are getting the following error on some post-functions script when creating subtasks. 

The error reads: [Static type checking] - The variable [sourceIssue is undeclared . @ line 1, column 33. 

 

We havent changed any of our code and were not getting this error previously. Should we be using something else instead of "sourceIssue"? Did you guys change something. 

Condition Script:

'Email KWM' in cfValues['Content Items']*.value && !(issue.summary.contains("CLONE -"))

Additional Script: 

issue.summary = 'CRF Email KWM - ' + sourceIssue.summary

 

Any help would be greatly appreciated. 

1 answer

This widget could not be displayed.

Hi James,

It's hard to know the exact reason without knowing what version you updated from or to.

I've been having a look through though, and prior to 4.3.0 it may well have been sourceIssue. On all versions above and including 4.3.0 I believe the variable you are looking for is originalIssue.

The bind variables are all normally listed underneath the code window by clicking on the question mark symbol.

Does this answer your question?

Hey there,

Thanks so much for getting back to me! We upgraded Jira from v6.4 to v7.4.0 .  We are running ScriptRunner 5.1.6. 

I tried using originalIssue instead of sourceIssue as you suggested, it no longer gives me the following error: 

The error reads: [Static type checking] - The variable [sourceIssue is undeclared . @ line 1, column 33. 

However, when I try to create the subtask, it does fail to run.

sourceIssue does manage to create subtask and run properly, but throws the following error: 

The error reads: [Static type checking] - The variable [sourceIssue is undeclared . @ line 1, column 33. 

So not sure what is causing the error, even tho, the code works. 

I tried looking for the question mark symbol for a list of bind variables, but don't see it. 

Any help in resolving this would be greatly appreciated. Thank you. 

 

Hi James,

Apologies for the late reply. Just to clarify, from your previous message, everything works fine with sourceIssue, you just get a static type checking error?

If that is the case then you should be fine. The ScriptRunner documentation (https://scriptrunner.adaptavist.com/latest/jira/#_static_type_checking) states that the static type checker may not always be correct. It evaluates at run time and therefore might be missing sourceIssue when actually it is being added at a later time, before runtime.

You should safely be able to ignore this error ;-)

Well, that's good news! Thank you very much for your help!! 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

546 views 3 19
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