Forums

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

Jira ScriptRunner syntax checking too strict

Jon Schewe October 9, 2020

I'm working with the example LDAP search script at https://scriptrunner.adaptavist.com/latest/jira/resources.html#_ldap_connection

The line "attributes.get('cn').get()" gives a syntax error because Object doesn't have a get method. Can ScriptRunner be made aware of the type of attributes so that the syntax error doesn't occur? 

 

1 answer

1 accepted

2 votes
Answer accepted
Ravi Sagar _Sparxsys_
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 9, 2020

Hi @Jon Schewe 

Did the script work in your instance?

Ravi

Jon Schewe October 9, 2020

Yes, the script executes fine. I just have these nasty red X's next to my code implying that something is broken. 

Ravi Sagar _Sparxsys_
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 9, 2020

You can ignore these STC errors. Also look at this page for information related to this topic: https://scriptrunner.adaptavist.com/latest/jira/#_tips_for_type_checking

Like Nic Brough -Adaptavist- likes this
Jon Schewe October 9, 2020

It would be nice if the examples didn't have STC errors out of the box. For someone new to ScriptRunner, I rely upon the STC to tell me when I've done something that isn't going to work.

I do see that there is an "as" clause in the example. I would have thought that would give the STC enough information to know the type of "attributes".

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.5.5
TAGS
AUG Leaders

Atlassian Community Events