Hello smart people,
I am trying to do validation on a comment during a transition between statuses. I want my comment to contain a certain tag, say :
[tagName] <some comment text>
If the body of the comment doesn't contain that text - I want to throw a validation message. It seems to me that this has to be done in validation part of the workflow, but I can't figure out how to grab the body of the current comment. After searching CommentManager, I only found ".getLastComment(issue)", but not currentComment.
Here is what I have right now:
import com.atlassian.jira.component.ComponentAccessor
import org.apache.log4j.Logger
def commentManager = ComponentAccessor.getCommentManager()
def lastComment = commentManager.getLastComment(issue)
def log = Logger.getLogger("com.acme.workflows")
log.warn(lastComment.body)
if(lastComment.body.contains("[public]")){
return true;
}
else{
return false;
}
Thanks,
Roman