...
Validators check that any input available to the transition (such as user-supplied input) is valid before the transition is performed. If a transition's validator 'fails', the transition's post functions will not be executed and the issue will not progress to the destination step of the transition.
You can use Power Scripts Scripts™ for Jira and SIL SIL™ to define a large set of validators beside the default validators offered by Jira, by just adding a (k) SIL SIL™ Validator to a transition and publishing the workflow, as described here.
...
Table of Contents |
---|
Info | ||
---|---|---|
| ||
You will need Power Scripts Scripts™ for Jira(server) Level: BASIC |
Comment required
...
Code Block | ||
---|---|---|
| ||
string errorMsg = "You must enter a comment!"; if(!hasInput("comment")) { return false, "comment", errorMsg; } |
Field has single value
A SIL SIL™ validator for checking if a multi-valued field does not contain more than one value during a transition:
Code Block | ||
---|---|---|
| ||
string errorMsg = "You must choose a single fix version!"; if(size(fixVersions) > 1) { return false, "fixVersions", errorMsg; } |
Parent status
A SIL SIL™ validator which ensures that the current issue's parent issue is in one of the specified Statuses:
...
Validation based on regular expression
A SIL SIL™ validator which checks if a text field matches a regular expression (eg for a social number):
...
Force a custom field to be required if another field was set to a certain value
A SIL SIL™ validator which makes custom field Product with id customfield_10200 required in the resolve screen only if the resolution was set to Fixed:
...
Ensure that the issue has at least one attachment
A SIL SIL™ validator which checks if an issue has any file attached during a transaction:
...
Validation based on mathematical expression
A SIL SIL™ validator which checks if a numeric custom field is greater than or equal to 0:
...
Validation based on date-time expression
A SIL SIL™ validator which checks if due date is before current date:
...
Compare two parsed texts
A SIL SIL™ validator which checks if description contains summary:
...
Users in a field are/aren't in a project role
A SIL SIL™ validator which checks if users selected in a multi user picker custom field are in a given project role:
...
A custom field is/isn't initialized
A SIL SIL™ validator which checks if a custom field is initialized during transaction:
Code Block | ||
---|---|---|
| ||
string errorMsg = "Field was not initialized!"; if(!hasInput("customfield_10500")) { return false, "customfield_10500", errorMsg; } |
Check user property
A SIL SIL™ validator which checks if a user property has a certain value:
Code Block | ||
---|---|---|
| ||
string COUNTRY = "Romania"; string errorMsg = "Assignee country must be " + COUNTRY; if(getUserProperty(assignee, "country") != COUNTRY) { return false, "assignee", errorMsg; } |