-
Notifications
You must be signed in to change notification settings - Fork 0
USER_GUIDE
A modern, template-driven scripting plugin for Jira Cloud. Bring your Jira automation to life with a VS Code-grade editor, no-code templates, and full execution logs β without ever touching Groovy.
- Introduction
- Quick Start
- Core Concepts
- Using Templates (No-Code Path)
- Writing Custom Scripts (Pro-Code Path)
- Manual Run & Testing
- Execution Logs
- Activating & Deactivating Scripts
- Limitations
- Troubleshooting
- Privacy & Security
- Roadmap
SmartScript is a Jira Cloud automation plugin built on the Atlassian Forge platform. It is designed to replace heavyweight, Groovy-based scripting tools with a lightweight, modern alternative that works for both administrators and developers.
- Jira Administrators who need powerful automation but don't want to write code from scratch β use ready-made templates with simple form fields.
- Developers who want to write custom logic in JavaScript with the comfort of a VS Code-grade editor (Monaco), real-time syntax checking, and instant test runs.
- 3 Built-in Killer Templates β Auto-assign by component, auto-comment on high priority, auto-label by keyword.
- Monaco Editor β The same editor that powers VS Code, embedded directly in Jira.
- Instant Test Run β Try your script with a mock event before going live.
- Execution Logs β See exactly what happened, when, and why.
- Active/Inactive Toggle β Pause scripts without deleting them.
- Native Look & Feel β Built with the Atlassian Design System.
- Visit the Atlassian Marketplace listing for SmartScript for Jira.
- Click Get app and install it on your Jira Cloud site.
- Approve the requested permissions (read/write Jira issues and store app data).
- Go to Jira Settings β Apps β SmartScript-Jira.
- You will see a sidebar (left) for your scripts and a main area (right) for editing.
- Click Create New Script (top of the sidebar).
- Click Load Template in the editor header.
- Choose Add Comment on High Priority from the dropdown.
- Customize the comment text and click Apply Template.
- Make sure the Active toggle is on, then click Save Changes.
- Create a test issue in Jira with priority Highest β the comment appears automatically.
That's it. You just deployed a working automation without writing a single line of code.
| Concept | Definition |
|---|---|
| Script | A unit of automation logic. Contains JavaScript code, a trigger type, and an active/inactive flag. |
| Trigger | The event that runs your script. Currently supported: Issue Created, Issue Updated, and Manual (run from UI only). |
| Template | A pre-written script with parameter slots. Selecting a template generates code for you. |
| Execution Log | A historical record of one script run. Includes timestamp, status, duration, and any console output or error. |
| Active / Inactive | An on/off switch. Inactive scripts are kept but never executed by triggers. |
Templates are the fastest way to deploy automation β no JavaScript knowledge required.
Automatically assigns newly created issues to a specific user when a chosen component is set.
Parameters:
-
Component Name β e.g.
Backend -
Assignee Account ID β The Atlassian Account ID of the assignee. You can find this by visiting the user's profile in Jira; the URL will contain
accountId=....
Trigger: Issue Created
Posts a predefined comment whenever an issue is created with Highest priority.
Parameters:
-
Comment Body β The text to post (e.g. "
β οΈ This high-priority issue requires immediate attention.")
Trigger: Issue Created
Adds a label to any issue whose summary contains a chosen keyword.
Parameters:
-
Keyword to search β e.g.
bug(case-insensitive) -
Label to add β e.g.
triaged
Trigger: Issue Created
- With a script selected, click Load Template.
- Choose a template from the dropdown.
- Fill in the parameter fields.
- Click Apply Template. The editor populates with the generated code.
- Click Save Changes. Templates do not auto-save.
π‘ Tip: After applying a template, you can still edit the generated code by hand β useful for combining multiple template behaviors or adding extra conditions.
β οΈ Note on quotes in parameters: If a parameter value contains a double quote ("), the generated code may break. Avoid"in parameter inputs, or remove it manually in the editor after applying.
If templates don't cover your case, write your own logic.
- Click in the editor area to start typing.
- Auto-complete and syntax highlighting are powered by Monaco (the VS Code engine).
- Save with the Save Changes button (top right). The button is disabled when there are no unsaved changes.
Inside a script you can use these globals only:
| Global | Description |
|---|---|
event |
The Jira event object. Includes event.issue.key, event.issue.fields.summary, event.issue.fields.priority.name, event.issue.fields.components, etc. |
console.log(message) |
Prints to the execution log. Strings, numbers, and objects are supported. |
updateIssue(key, jsonBody, callback) |
Updates an issue. jsonBody must be a JSON string matching Jira's REST API format. |
addComment(key, plainText, callback) |
Adds a plain-text comment. Markdown/ADF is converted automatically. |
setAssignee(key, accountId, callback) |
Sets the assignee. Pass an empty string to unassign. |
Built-in browser APIs (
fetch,XMLHttpRequest), Node.js modules (require,import), and timers (setTimeout) are not available in the sandbox.
The script sandbox only supports ECMAScript 5. Modern JavaScript will throw a SyntaxError.
| β Don't use | β Use instead |
|---|---|
const, let
|
var |
() => { ... } (arrow function) |
function () { ... } |
`Hello, ${name}` (template literal) |
"Hello, " + name |
async / await / Promise
|
Callback pattern (the helpers above are async via callback) |
Object.assign(...) (works), Array.includes(...) (may fail) |
Use for loops and indexOf for safety |
/**
* Assign issues with specific labels to specific users.
*/
var issue = event.issue;
var labels = (issue.fields && issue.fields.labels) || [];
var assigneeMap = {
"frontend": "557058:abc-account-id-1",
"backend": "557058:abc-account-id-2",
"design": "557058:abc-account-id-3"
};
for (var i = 0; i < labels.length; i++) {
var target = assigneeMap[labels[i]];
if (target) {
console.log("Matched label: " + labels[i]);
setAssignee(issue.key, target, function (res) {
console.log("Assignment status: " + res.status);
});
break;
}
}var issue = event.issue;
var summary = issue.fields ? issue.fields.summary : "";
if (summary.toLowerCase().indexOf("urgent") !== -1) {
addComment(issue.key, "Auto-flagged as urgent. Please respond within 2 hours.", function (res) {
console.log("Comment posted: " + res.status);
});
}The βΆ Run button executes your script in a mock environment so you can test logic before going live.
- A fake event is injected:
{ eventType: 'manual_test', issue: { key: 'TEST-123', id: '10000' } }. - Helper functions (
updateIssue,addComment,setAssignee) do not call Jira. They return{ status: 200, mock: true }and log a message. - The script's return value and all
console.logoutput are shown in the result panel below the editor.
- Write or load a script.
- Click βΆ Run.
- The result panel appears at the bottom of the editor:
- Green = Success. Shows the return value.
- Red = Error. Shows the error message.
-
Black box = Captured
console.logoutput (always shown when present).
- Click Close to dismiss the panel.
π‘ Mock mode is the right tool for verifying syntax, control flow, and basic logic. To verify real Jira behavior, set the trigger to Issue Created or Issue Updated, save, and create a test issue.
Click the Execution Logs tab (top of the editor area) to view your last 50 script runs.
| Field | Description |
|---|---|
| Time | When the script ran (local time). |
| Script | The script's display name. |
| Issue | The Jira issue key that triggered the run. |
| Status |
Success (green) or Error (red). |
| Duration | Total execution time in milliseconds. |
| Result/Error | The captured console.log output (success) or error message (failure). Hover for full text. |
- Refresh β Reload the latest logs.
- Clear All β Permanently delete all execution logs.
π Logs are limited to the most recent 50 runs. Older logs are deleted automatically.
Use the Active toggle in the script editor header to enable or disable a script without deleting it.
| State | Behavior |
|---|---|
| Active (green badge) | The script will run when its trigger fires. |
| Inactive (gray badge) | The script is preserved but skipped by all triggers. βΆ Run still works for testing. |
π‘ Best practice: Deactivate scripts during maintenance windows or when you suspect a script is misbehaving β it's reversible and faster than deleting.
Please be aware of these constraints when designing your automation:
- 25-second execution timeout per Forge function call (Atlassian platform limit). Long-running scripts will be terminated.
- Scripts run sequentially. If multiple scripts are active for the same trigger, they execute one after another. Total time = sum of all script times.
- 50-log retention. Older logs are automatically purged.
Currently supported triggers:
- β Issue Created
- β Issue Updated
- β Manual (run from UI only)
Not yet supported (planned):
- Workflow transitions
- Comments added
- Attachments uploaded
- Scheduled runs (cron)
- ECMAScript 5 only (see Β§5).
- No external HTTP calls outside the provided
updateIssue,addComment,setAssigneehelpers. - No file system access, no
require, noimport.
Currently only three high-level Jira API helpers are exposed. Other endpoints (e.g., transitions, custom fields with non-trivial schemas) require manual JSON construction passed to updateIssue.
You used modern JavaScript (const, let, =>, template literals). Refactor to ES5 β see Β§5.
The plugin lacks permission to perform the action. Check that:
- The required scopes are granted (
write:jira-workfor issue updates). - The user/issue you're targeting exists.
- The site administrator approved the latest scope changes after upgrading.
The JSON body is malformed for Jira's API. Check the Jira REST API documentation for the exact field structure.
- Confirm the Active toggle is on.
- Confirm the Trigger matches the event you expect (
Issue Createddoes not fire on updates). - Check the Execution Logs tab β if there's no entry for your issue, the trigger never fired (often a permission or scope issue).
Refresh the page. Monaco Editor occasionally fails to mount on the first load due to network conditions. If it persists, check your browser console for errors and contact support.
Mock mode does not call the real Jira API, so success in mock β success in production. Common causes:
- The mock issue (
TEST-123) has a different field shape than your real issue. - Your real account lacks permission for the action.
- Account IDs hardcoded in the script are wrong (typos, deleted users).
All data is stored in Forge KV Storage, which is hosted within your Atlassian Cloud instance. We store:
- Script definitions β name, description, code, trigger type, active state, timestamps.
-
Execution logs β the most recent 50 runs, each containing the script ID, name, issue key, status, duration, and any
console.logoutput.
- We do not transmit any data to third-party servers.
- We do not store user credentials, OAuth tokens, or session data.
- We do not persist Jira issue contents β only the issue key and what your script logs.
- Scripts persist until you delete them.
- Execution logs are kept for the most recent 50 runs and are then automatically deleted.
- Uninstalling the app removes all stored data.
| Scope | Why |
|---|---|
read:jira-work |
Read issue details when triggers fire. |
write:jira-work |
Update issues, post comments, set assignees. |
read:jira-user |
Resolve account IDs for assignee operations. |
storage:app |
Persist scripts and logs. |
User scripts run inside js-interpreter, a pure-JavaScript ES5 interpreter. The interpreter has no access to the host's network, filesystem, or environment. Only the four helpers (console.log, updateIssue, addComment, setAssignee) cross the boundary, and each enforces a fixed URL pattern that prevents arbitrary endpoint access.
We are actively working on the following features for upcoming releases:
- Git Synchronization β Sync scripts to your GitHub/GitLab repository ("Script as Code").
- More Built-in Templates β Subtask synchronization, due-date enforcement, label cleanup.
- Enhanced Trigger Coverage β Workflow transitions, comments, attachments.
- AI-Native Authoring β Generate scripts from plain-English prompts (BYOK: Bring Your Own Key).
-
Type Definitions in Editor β Full Jira REST API auto-completion via embedded
.d.tsfiles. - Scheduled Triggers β Run scripts on a cron schedule.
- Granular Permissions β Per-script edit/view permissions.
- Issues & Feature Requests: Project repository (link to be added)
- Email: (to be added)
-
Atlassian Community: Tag posts with
#smartscript-jira
SmartScript for Jira β Built on Atlassian Forge. Β© 2026.