Warning |
---|
Looking for the documentation on the newest versions of Power Actions for Jira 8? Click here and leave these dusty old pages behind! |
On this page:
Table of Content Zone | |
---|---|
|
Basic Usage
The Action script contains instructions that will be executed when calling an action. If you're not yet familiar with SIL, see Simple Issue Language™ usage.
...
Code Block |
---|
string fruitLabel = getElement(argv, 0); string fruit = getElement(argv, 1); string chocolateLabel = getElement(argv, 2); string chocolate = getElement(argv, 3); string [] errors; if( isNull(fruit) ){ errors = addElement(errors, fruitLabel); errors = addElement(errors, "What? You don't like fruits?"); } if( chocolate != "yes" and chocolate != "of course"){ errors = addElement(errors, chocolateLabel); errors = addElement(errors, "No way!"); } return errors; |
Redirecting and Preventing Refresh
Since version 4.5.5, Power Actions got the ability to redirect to some random page and also to prevent refresh. For this to happen, the return of the action should be of predefined type BActionReturn, which is defined as having the following fields:
...
We recommend you to use the structure above whenever possible, although the old way is still available (i.e. old scripts do not need to change).
Example
Iterating over uploaded files:
Code Block |
---|
string [] files = BA_getMultiValues(argv, "file"); for(int i = 0; i < size(files); i+=2){ number ORIGINAL_NAME = i; number NEW_PATH = i + 1; desc += "File " + files[ORIGINAL_NAME] + " was uploaded to " + files[NEW_PATH] + "\n"; } |