Table validation on workflow transition

Table validation on workflow transition

Jira workflow validator

The STAGIL Tables on workflow transition ensures that a transition can only be executed when the specified table has a value.

  1. Access the workflow editor.

  2. Click Add rule, then Validate details.

  3. Select Validate that table is not empty.

  4. Add parameters to validator:

    • Choose the transition.

    • Select the table to validate.

    • Enter a custom error message to display if the transition is attempted without meeting the Tables requirement.

image-20251231-143321.png
Workflow Validation configuration

 

image-20251231-143424.png
Error message in the issue view
  1. Click Add, and then Update workflow.

Workflow validator is currently supported only in company-managed projects.

Scriptrunner Validator

Using a STAGIL table or checklist as a validator can be easily achieved through a Scriptrunner Validator script utilizing a Jira Expression as a condition.

Table value validation

Let's take a look at an example where we create a validation that restricts users from transitioning an issue if the STAGIL table has no values.

Here are the steps to follow:

  1. Install Scriptrunner by Adaptavist.

  2. Access the workflow editor.

  3. Choose the relevant transition and click on Validators, then Add Validator.

  4. Opt for the ScriptrunnerScript option with the description "Add a ScriptRunner Script Validator that evaluates a Jira Expression to determine whether data input to the transition is valid".

  5. Assign a name to the validator.

  6. Compose a custom message that users will see when they attempt to transition the table, but the table has no values and does not fulfil the Jira Expression requirement.

  7. The Script Validator field is where you can input the Jira Expression or validation condition.

Jira expression:

Validation is passed if table has values at least in one cell:

issue.properties['stjc-field-22'] != null

Validation is passed if table has values at least in one column:

issue.properties['stjc-field-22']?.columns ? true : false

where

22 is the Table ID.

Column value validation

Validation is passed is there if a column value at least in one row in the table

issue.properties['stjc-field-22']?.column9999 ? true : false

where

22 is the Table ID;

9999 is a Table column ID.