Skip to end of banner
Go to start of banner

Validators

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

We've encountered an issue exporting this macro. Please try exporting this page again later.

Validators are just like conditions in that they return a true or false value. If TRUE, the user is allowed to compete the transition. If FALSE, the user will not be allowed to complete the transition. However, unlike conditions, a message will be displayed telling the user why they were unable to complete the transition.

Example 1 - Issue must have subtasks

string errorMsg = "Issue must have subtasks!";
if(size(subtasks(key)) == 0) {
    return false, errorMsg;
}

Example 2 - Must be a comment in the transition screen

string errorMsg = "You must enter a comment!";
if(!hasInput("comment")) {
   return false, "comment", errorMsg;
}

Because the second parameter (optional) was used in this example the error message will also display beneath the comment field.

When using transition screens be sure to use routines that can read screen values like hasInput() or getInput() otherwise the script will retrieve the value (if any) stored in the issues and not the value the user just input into the field and is trying to save.

  • No labels