Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Script Validator for create transition to raise user defined error when fixvVersion is numeric

smuppala February 27, 2018

Hi There,

             I have Created a Validator using Script Validator on Create transition to verify if the fixVersion has numeric values , block the cloning, sub-task creation since both are create events.  Logic is working fine. I want to display user defined error instead of system error. When I am cloning a bug that has numeric fixVersion value I am getting the following error. I need to overwrite this error. Need help of how to overwrite this.

*********************************************

Clone issue: AS-XXXXX

admin errors exception

com.atlassian.jira.exception.CreateException.Error occurred

while creating issue through workflow

*********************************************

My code snippet

def origFixVer = issue.getFixVersions()
String origFixVersion = origFixVer[0]

def m = origFixVersion =~ /^(\d+)/

if( m ){
    log.debug(String.format("User selected Numeric Versions for %s",issue.key))
    log.warn(s1)

    invalidInputException = new InvalidInputException("fixVersions", "Choose a better fix version")

}

1 answer

2 votes
Mahesh S
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 27, 2018

You cannot override the System Validation error. Instead, your custom validation should work and throw Custom error message before the System Validator does. I have tried a similar validation for a custom field and the Custom exception is as follows.

invalidInputException = new InvalidInputException("Message")

This worked fine.

smuppala February 28, 2018

Great Thanks a lot Mahesh! this worked

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events