Workflow Automation

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.

Configuring Validators, Post Functions, and Conditions

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

You can modify the workflow only while it's active, therefore you have to create a draft workflow by clicking the Create draft link.
The result should look like one of the images below.

Text View

Text view of workflow
  1. The Diagram and Text buttons can be used to switch the view mode of the workflow.

  2. Click the transition name to edit the transition.

Diagram View

Diagram view of workflow
  1. The Diagram and Text buttons can be used to switch the view mode of the workflow.

  2. In Diagram mode you must first click a transition line to see the transitions options.

  3. Once a transition is selected you can click the Post Functions link for that transition.
    Clicking a transition will show the transition triggers, conditions, validators, and post functions.

Keep in mind that:

  1. The post functions are called every time when a ticket advances from one state to another.

  2. The transition is made possible only if the conditions are fulfilled. Therefore, a condition must return "true" or "false" to signal whether the condition is met or not.

  3. The validators must validate data before the transition is fired. Subsequently, a validator is entitled to return "true" or "false" and optionally the field and the error message you want to show in the interface.

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.

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

After you click the Add button, you will be presented with 3 options (see screenshot below):

  1. Template - use the script template editor to create a new script

  2. New Script - write a new script on the fly

  3. Existing Script - use a script that has already been written and exists in the SIL Manager

 

 

For the purposes of this example, choose Existing Script and click Next.

 

 

Now, click the edit icon (pencil) next to the script input to select the script you wish to use for the post function.

 

Click next to apply the selected script as a post function.

 

You can create a new script or pick a script that was already created or even used for other purposes in the silprograms folder (or wherever those files are located, established by your configuration).

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

Modifying 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.

Note

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

Workflow View

This view will help you browse through your workflow without having to open the program every time to see what it does.

On the first line we have the name of the SIL program. After that, you have a short description of the program, which you can write by commenting on the first lines (max. 3 lines) in your code. For example, the program you see on the right contains "//Your SIL code should go in here" on the first line.

Finally, you have the error notifier which tells you whether the program is correct. If there are any errors, open the program for a more detailed description of the cause. If the program is correct, this line will be blank.

See also