Currently, I'm trying to define two conditions regarding the component field in a subtask:
I tried to define a behaviour with respect to the specific project and field. I was successfull in checking the amount of components in the specific subtask and to send a user message or an invalid input message.
Now my question: When I'm entering two components in the edit dialogue the behaviour fires, but jira updates the issue (what I wanted to avoid) although the behaviour throws the exception.
Here is the snapshot of my behaviour code:
def issueManager = ComponentAccessor.getIssueManager()
def issue = issueManager.getIssueObject("ITP-25")
def NumberComponents = issue.getComponents().size()
log.debug "NumberComponents: " +NumberComponents
if (NumberComponents != 1){
throw new InvalidInputException("component", "Only one component is allowed")
return null
}
I tried some alternatives, e.g. "return false" or throwing the invalidInputException without the assignment to the field...but nothing helps. Thus, I assume I'm not on the right track...
Has someone an idea? Thanks a lot in advance!
No, I'm going to try it in a few minutes :-)
what kind of object is "somefield"?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
the field you would like the error message to show against - maybe the Components field would work, not sure
your code will also have to clearError() when the condition is clear
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tom,
it works! Thanks a lot - You have saved some painfull hours of my time :-)
best regards,
Günter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.