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
You can use transientVars, e.g.
String comment = transientVars?.get("comment")?.toString()
You'll get a Static type checking error in the editor, but it works fine.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Couldn't find any documentation on transientVars, only a small mention in here:
https://scriptrunner.adaptavist.com/latest/jira/recipes/workflow/get-workflow-vars.html
Do you know of any documentation on this and other "hidden" things?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, I know of no good source for goodies like that. I just happened to stumble upon transientVars by way of searching for a solution to a problem and also found little in the way of information about it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, hope things thread brings more searchable info to other users who needs to do the same or similar stuff.
Thanks for help again :)
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.