sourceIssue is undeclared - static type checking

James Valles October 3, 2017

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

0 votes
Stephen Cheesley _Adaptavist_
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.
October 6, 2017

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?

James Valles October 10, 2017

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. 

 

Stephen Cheesley _Adaptavist_
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.
October 23, 2017

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 ;-)

James Valles October 23, 2017

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events