I am trying to validate a JIRA transition using a scriptrunner script. I would want to log some details in the jira comments section and throw a UI exception which says "Refer to comments for more details"
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.comments.CommentManager
// some condition evaluation. Lets say one that fails
CommentManager commentManager = (CommentManager) ComponentManager.getComponentInstanceOfType(CommentManager.class)
commentManager.create(issue, currentUser,"reason for failure", true)
invalidInputException = new InvalidInputException("Refer to comments for more details")
This code does produce a pop up with
"Refer to comments for more details
It seems that you have tried to perform an illegal workflow operation.
If you think this message is wrong, please contact your JIRA administrators"
The comment does not show up!!!!!! If I do not throw the exception, then the transition will go through and logs a comment.