Async events
Trigger scripts asynchronously via the Forge Queue. One per script (singleton).
Async events are triggered from scripts using asyncEvent.push(scriptId, payload?, options?) or asyncEvent.pushSelf(payload?, options?). The target script must have an enabled async event trigger - otherwise events are discarded by the consumer.
Async events are also the way to chain scripts: event triggers ignore Jira events caused by the app itself, so one event script cannot start another through Jira events (see Loop prevention).
Configuration
| Setting | Description |
|---|---|
| Description | Optional description (up to 2,000 characters) |
Run as
Scripts run with the actor configured on the script. With Current user there is no user context, so the script runs with application permissions.
Event variable
The event variable in the target script contains:
| Property | Type | Description |
|---|---|---|
event.payload |
object | Data passed by the sender (empty object if not provided) |
event.source |
string | "script" |
event.pushedBy |
string | Account ID of the sender |
event.pushedAt |
number | Timestamp in milliseconds |
event.scriptId |
string | UUID of the current script |
event.issueKey |
string/null | Issue key (e.g. "PROJ-123") or null |
event.depth |
number | Current chain depth. 0 = initial trigger (can push further events), 1 = triggered script (cannot push further - chain ends here). See Limits |
event.chainId |
string | UUID identifying the event chain (for tracing) |
Automatic context: When
issueKeyis provided via options, the runtime variablesissueandissueKeyare set automatically in the target script.
Options
| Option | Type | Description |
|---|---|---|
issueKey |
string | Issue key in PROJ-123 format, passed as context to the target script |
delayInSeconds |
number | Delay before processing (0-900, max 15 minutes) |
Return value
Both push() and pushSelf() return { jobId: string }.
Limits
Each async event run gets up to 55 seconds of execution time and 250 API calls. See Limits for the other async event limits including call counts, payload size, delay, and chain depth.
Chain depth: To keep cascading script chains from growing out of control, the max chain depth is 1 - a script started by an async event cannot push a further one at all. The flat limit of 10 async event pushes per script applies to scripts at depth 0.
Example
Sender script - pushes an event to a target script:
// Push with payload and issue context
asyncEvent.push(
"550e8400-e29b-41d4-a716-446655440000",
{ action: "process", itemId: 42 },
{ issueKey: "PROJ-123", delayInSeconds: 60 }
)
Target script (must have an async event trigger enabled):
log("Received from:", event.pushedBy)
log("Depth:", event.depth, "Chain:", event.chainId)
if (event.payload.action === "process") {
// issueKey was passed in options, so issue is auto-loaded
log("Processing:", issueKey, "-", issue.fields.summary)
}
See the Async Event API for the full scripting reference.
See also
- Triggers Overview - All trigger types at a glance
- Scheduled Triggers - Run scripts on a schedule
- Event Triggers - React to Jira events
