I have been asked to add a post-function that adds a comment to an issue on a transition if a particular field is empty. I cannot find any way to do this at all.
I tried to use the code below but this failed with a 'cannot find matching method' error. In any case, even if I wanted to use scriptrunner, the only way I can see to use this is to use a custom script post-function, which lacks the conditional section.
I have been searching high and low for an answer but to no avail. The solution does not need to be scriptrunner, though the only other option I have is JSU and I don't see a way of doing it there.
CODE:
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.comments.CommentManager
ComponentManager componentManager = ComponentManager.getInstance()
CommentManager commentManager = componentManager.getCommentManager()
commentManager.create(issue, transientVars.context.caller, "Comment automatically generated...", false)