Use the Code Editor to simplify the process of writing scripts in ScriptRunner. The browser-based Code Editor provides completions, Javadoc lookups, and parameter assistance using three simple keyboard shortcuts.
Completions - Press Ctrl+space to complete the current class, method, property or variable.
Parameter hints - Press Ctrl+p when inside method parameters to show the possible parameter types for a method.
Javadoc lookup - Press Ctrl+j when the cursor is on a method, property, or class, to open the Javadoc for this symbol.
|For more advanced usage we recommend you move on to IDEA integration, however for simple scripts or one-liners it’s more convenient to use the browser.|
Press Ctrl+space to display a list of suggestions based on what is written in the Code Editor. Select a completion or continue typing, suggested completions narrow down as more is typed.
A simple condition is being added that allows the transition only if the issue has been reported by the user with key: admin.
issue is commonly passed in the script binding.
|Click the question mark icon below the script to see binding variables.|
Pressing Ctrl+space shows a list of possible completions. The text to the right of the suggestions shows the type of the property or return type of the method.
Select one of the suggested completions or continue typing, the suggestions narrow down as you type. Alternatively, type part of a method or property, for example
issue.getP, then press Ctrl+space.
To save typing, use camel case abbreviations. For example, to get a
CustomField instance from
getCusFiObj to display
Text within parentheses shows the types for any expected arguments.
Sometimes there may be multiple methods with the same name, but with different types of parameters. For example, obtain a
CustomField instance using its numeric ID, or its
Completions also work for classes. Most standalone scripts require a
ComponentLocator, but it’s hard to remember the class name for the
To save time, enter a part of the class name, using camel case abbreviations if required, and press Ctrl+space.
Upon selecting the class, the
import line is added automatically.
When typing method parameters, it is easy to forget the expected types. The Code Editor displays all possible parameter types applicable. Press Ctrl+p to show possible options based on the text entered in the Code Editor.
Bold items indicate the parameter being entered or edited. Greyed out items are methods that are incompatible with the parameters typed.
With hundreds of methods and properties, it is difficult to keep track of what each one does. The Code Editor helps to simplify this process by linking to the Javadoc for each method, property, or class. Press Ctrl+j to open the Javadoc in a new browser tab.
|The image above is illustrative. The Javadoc opens in a new tab. If you request the Javadoc for a different method, the same tab is reused. Javadoc currently works for the Java and Groovy standard libraries, and the Jira API only.|
There are some limitations to the Code Editor; work is ongoing to reduce these limitations. As mentioned, Javadoc for Bitbucket, Confluence and Bamboo APIs, and ScriptRunner’s API (e.g. Behaviours) is not available. However, completions and parameter hints are available for all.
Have questions? Visit the Atlassian Community to connect, share, and learn with other Atlassian users and experts, including Adaptavist staff.
Want to learn more? Check out courses on Adaptavist Learn, an online platform to onboard and train new users for Atlassian solutions.