During a transition I am editing the comments field and I am trying to leverage a behavior to check to make sure the comment is formatted correctly. I am able to apply the transition and there is no error. When I open the next transition that contains a comment field, it shows an error, but I am unable to edit the comment that has the error. I am thinking that the behaviors only get evaluated when the dialog is initialized as opposed to when the user applies the transition.
def commentField = getFieldById(getFieldChanged())
def validString = true
CommentManager commentMgr = ComponentAccessor.getCommentManager()
// I believe the next step will return the comment I just added during the transition
def comment = commentMgr.getLastComment(underlyingIssue)
if ( comment ) {
String commentText = comment.getBody()
// Do some string evaluations....
}
if (commentField) {
if(validString) {
commentField.clearError()
commentField.setValid(true)
} else {
commentField.setError("ERROR in comment")
commentField.setVald(false)
}
}