Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

SIL Not recognizing getIssueFieldNames function

Christiam Hernandez October 22, 2018

Hello, im beginning with SIL and Power Scripts, however whether i try to create my first script:

string [] fields = getIssueFieldNames(issue.key);
string customKpiField = "";

for(string _fieldName in fields){
if(contains(toLower(_fieldName), "kpi")){
customKpiField = _fieldName;
}
}
logPrint("Error", "KPI Field: "+customKpiField);

I get the following errors:

  • [SIL Error on line: 1, column: 20] Variable fields cannot be initialized with type null
  • [SIL Error on line: 1, column: 20] Routine >>getIssueFieldNames<< is not defined!
  • [SIL Error on line: 1, column: 44] Cannot check accessor for null types
  • Failed to retrieve from cache [[issue]]

I assume all errors are because of the function getIssueFieldNames therefore it takes a null as a type declaration and everything else...

 

can i get some help please?

 

1 answer

1 accepted

1 vote
Answer accepted
Alexey Matveev
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 22, 2018

Hello,

Your script should look like this:

string [] fields = getIssueFieldNames(key);
string customKpiField = "";

for(string _fieldName in fields){
if(contains(toLower(_fieldName), "kpi")){
customKpiField = _fieldName;
}
}
logPrint("Error", "KPI Field: "+customKpiField);

You get the key of an issue by calling the key variable, not issue.key

Christiam Hernandez October 22, 2018

yes, you are totally right, however that function is still not getting recognized:

 

  • [SIL Error on line: 1, column: 20] Variable fields cannot be initialized with type null
  • [SIL Error on line: 1, column: 20] Routine >>getIssueFieldNames<< is not defined!
Christiam Hernandez October 22, 2018
Alexey Matveev
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 22, 2018

What is your SIL engine? It is available from 3.0.8

Christiam Hernandez October 22, 2018

I'm in Jira Cloud so... I assume it's the latest since i installed the plugin the last week, if not... how can i see which version is my Jira using ?

Alexey Matveev
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 22, 2018

The getIssueFieldNames(issueKey) method is not available for Jira Cloud, unfortunately.

Suggest an answer

Log in or Sign up to answer