Francisco Francisco - 3 months ago 33
Groovy Question

Getting currentUser in post-function Jira

I have the following line of code

String currentUser = ((WorkflowContext)transientVars.get("context")).getCaller();


Then I proceed to call

(comment != "") && commentManager.create(parent, currentUser, comment, true);


My question is, that
CommentManager
now requires the
applicationUser
object instead of a
String
. So how do I get the
currentUser
that would return the
applicationUser
.

Question on Atlassian board

Answer

ComponentAccessor.userManager.getUserByName(userName) will give you the ApplicationUser for a username string.