Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 20

Contents

Table of Contents
maxLevel3
excludeSee also

One of the best features in Power Scripts is customizing workflows. Using the power of SIL, you can add conditions, validators, and post functions on any transition from your workflow.

...

After you install Power Scripts for Jira, go to the Administration > Workflows page and create a workflow, associated with a project.

...

An important consequence of the above model is that conditions and validators should not have side-effects. In fact, Power Scripts for Jira is discarding modifications of the issues, allowing them to occur in the post function only but it cannot discard modifications made on another database, for instance, applied using the sql routine (see sql() routine for details).

To create conditions, validators and post functions, click the corresponding Add link at the top of the workflow management tab.

Note
titleNote

For the cloud version for conditions and validators see Cloud Conditions and Validators

The following image shows the creation of a test post function.

...


Return to the transition screen, you will see that your newly added post function is reflected in the view:


Warning
titleModifying Issues

Avoid modifying issues in conditions and validators, as they are supposed to be read-only. Do not yield to that temptation! You should modify issue values (or create new issues, or change anything) in the post function only. In fact, SIL runs executes the validators and conditions in the read-only mode, discarding changes.

Info
titleInfo

Starting with Power Scripts for Jira 4.0, your SIL program will be saved either on the disk in the folder specified in the configuration or in the database. The filename is obtained by removing any invalid characters from the program name you entered and appending a number to help you browse through different versions of the same file.

Note
titleNote

For the best experience, we recommend Google Chrome or Mozilla Firefox.

Return codes

Returns codes are different for validators, conditions and post functions.

For validators

Code Block
return false, "assignee", "We have failed, assignee is not ok";

The first field tells us that we have failed, the second indicates the field, the third is the message that will be shown on the UI. For the moment, the filed name must be a "bare" name. That means that it should comply with the name given to the HTML objects displayed (e.g: for customfields it will be customfield_xxxxx). You can inspect the HTML source of the edit screen to see the "bare" name of a field.

For example, you can check whether certain fields were filled out during a workflow transition. To do that, use the hasInput routine.

For conditions

Code Block
return false; //to signal that condition is not fullfilled.

Just tell Jira this condition is not fullfiled.

For post functions

Code Block
return;

return ends the program, any values are ignored.

...