Hi All,
i have jira app (data center) Jira Data Center 9.12 and Scriptrunner 8.17.0 installed.
I have a project (type : IT service management ) with a default workflow Jira Service Management default workflow
I Have created a customer script validator associated to this poject for this project on Createe Transition in order to restrict the user to create a new ticket which have "test" string in summary
The code is the below
def summary = issue.summary
// Check if the summary contains the string "test"
if (summary && summary.toLowerCase().contains("test")) {
// Issue creation is not allowed
return "Issue creation with 'test' in the summary is not permitted."
}
After Testing , I found the script is detected as the number for the execution is incremented but the issue is created normally for an issue which have "test" in summary
Please advice
Regards,
Hello Peter-Dave,
The exception is used now and the validator is now working
Thanks
You might find the "Simple Scripted Validator" simpler to use.
You just have to return a true or false to determine if the validation should pass or not.
But if you really want to keep the Custom Script Validator, you have to throw an exception in order to generate an error.
import com.opensymphony.workflow.InvalidInputException
def summary = issue.summary
// Check if the summary contains the string "test"
if (summary && summary.toLowerCase().contains("test")) {
// Issue creation is not allowed
throw new InvalidInputException("Issue creation with 'test' in the summary is not permitted.")
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.