Automation for Jira
ScriptRunner provides an action for Automation for Jira, that lets you run your own code.
Due to incompatibly changing APIs in Automation for Jira, we provide two actions. One is deprecated although there are no plans to remove it, and you do not need to migrate to the newer version unless you need access to something only available in the newer version.
At this stage the only function available is a "custom script", but you can call other ScriptRunner functions programmatically.
Both actions provide simply a way to run a "custom script", but you can call other ScriptRunner functions programmatically.
Binding Variables
issue
The issue object that triggered the event
currentUser
The ApplicationUser defined as the actor for the rule
initiator
The ApplicationUser that initiated the event
inputs
The ComponentInputs. This could be used for example to retrieve the sprint if the trigger is Sprint Created Event.
ruleContext
The current RuleContext. This can be used to evaluate smart values.
Additionally there are two utility functions available for writing information and error messages to the Automation for Jira audit log. They are addMessage(String message)
and addError(String errorMessage)
Example:
addMessage("My message")
addError("My error message")
produces:
Smart Values
You can evaluate smart values using ruleContext.renderSmartValues(String)
for example:
log.warn ("Initiator of the action was... " + ruleContext.renderSmartValues('{{initiator}}'))
Deprecated version
Binding Variables
issue
The issue object that triggered the event.
currentUser
The ApplicationUser defined as the actor for the rule.
errorCollection
An ErrorCollection - use it to record error conditions, eg errorCollection.addErrorMessage("Something went wrong").
executionContext
Use this if you need to retrieve any information about the rule that is currently firing.