Table of Contents | ||||
---|---|---|---|---|
|
...
NOTE: Some scripts will rely on a transition screen being present in the selected transition. See the example below:
Example:
...
Testing the Script
Testing the script is as simple as attempting to complete the transition without a comment present. Notice In the example below, notice that the message text that was in script gets displayed to the user when the transition.
...
Name | Required | Description |
---|---|---|
Description | NO | The description text will be added to a comment at the head of the script so other users can be informed of the purpose of the script. |
Requires transition screen: YES
Script
Code Block |
---|
string errorMsg = "You must enter a comment!"; if(!hasInput("comment")) { return false, "comment", errorMsg; } |
...
Name | Required | Description |
---|---|---|
Customfield | YES | The custom field for which the validator is checking the presence of a value. |
Description | NO | The description text will be added to a comment at the head of the script so other users can be informed of the purpose of the script. |
Requires transition screen: YES
Script
Code Block |
---|
string errorMsg = "The field must have a value!"; if(!hasInput("customfield_10626")) { return false, "customfield_10626", errorMsg; } |
...
Name | Required | Description |
---|---|---|
Description | NO | The description text will be added to a comment at the head of the script so other users can be informed of the purpose of the script. |
Requires transition screen: NO
Script
Code Block |
---|
string errorMsg = "Issue must have subtasks!"; if(size(subtasks(key)) == 0) { return false, errorMsg; } |
...
Name | Required | Description |
---|---|---|
Link Type | YES | The name of the link type that should be linked to the issue before it may be transitioned. |
Status | YES | The workflow status name to apply the validation script to. |
Description | NO | The description text will be added to a comment at the head of the script so other users can be informed of the purpose of the script. |
Requires transition screen: NO
Script
Code Block |
---|
string errorMsg = "Required linked issues are not in the correct status!"; string[] blockingIssues = linkedIssues(key, "Cloners"); for(string issue in blockingIssues) { if(%issue%.status != "In Progress") { return false, errorMsg; } } |
...
Name | Required | Description |
---|---|---|
Status | YES | The status the parent must be set to in order for the transition to be allowed to complete. |
Description | NO | The description text will be added to a comment at the head of the script so other users can be informed of the purpose of the script. |
Requires transition screen: NO
Script
Code Block |
---|
string errorMsg = "Parent issue should have status Done!"; if(!isNull(parent) && parent.status != "Done") { return false, errorMsg; } |
...
Name | Required | Description |
---|---|---|
Status | YES | The status that all subtasks must be in before the transition is allowed to complete. |
Description | NO | The description text will be added to a comment at the head of the script so other users can be informed of the purpose of the script. |
Requires transition screen: NO
Script
Code Block |
---|
string errorMsg = "Subtasks are not in the In Progress!"; string[] subtasks = subtasks(key); for(string subtask in subtasks) { if(%subtask%.status != "Done") { return false, errorMsg; } } |
...