...
Code Block |
---|
|
string errorMsg = "Invalid social number format.";
string REGEXP = "^\\d{3}-\\d{2}-\\d{4}$";
if(!matches(customfield_10100, REGEXP)) {
return false, "customfield_10100", errorMsg;
} |
Force a custom field to be required in resolve screen only if the resolution was set to a certain value
A SIL validator which makes custom field Product with id customfield_10200 required in the resolve screen if the resolution was set to Fixed:
Code Block |
---|
|
string errorMsg = "To resolve the issue as 'Fixed' you should give a value to field 'Product'.";
if(resolution == "Fixed" && !hasInput("customfield_10200")) {
return false, "customfield_10200", errorMsg;
} |
Ensure that the issue hast at least one attachment
A SIL validator which checks if an issue has any file attached during a transaction:
Code Block |
---|
|
string errorMsg = "At least one file must be attached to the issue.";
if(size(attachments) == 0) {
return false, errorMsg;
} |
Validation on linked issues
Blocking Start Progress transition whenever current issue has a link of type Blocks with an issue in a status different from Resolved and Closed:
Code Block |
---|
|
string errorMsg = "Progress can't start because there is at least one blocking issue.";
string[] statuses = {"Resolved", "Closed"};
string[] blockingIssues = linkedIssues(key, "Blocks");
for(string issue in blockingIssues) {
if(!elementExists(statuses, %issue%.status)) {
return false, errorMsg;
}
} |
...