I am adding a post function to a workflow that just adds a pretty comment for an approval transition. I can get the username into the comment, but I need the users full name.
Here is my code:
import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.comments.CommentManager import com.opensymphony.workflow.WorkflowContext import org.apache.log4j.Category String currentUser = ((WorkflowContext) transientVars.get("context")).getCaller(); commmgr = (CommentManager) ComponentManager.getComponentInstanceOfType(CommentManager.class) commmgr.create(issue, currentUser, "$currentUser Approved this ticket", true) issue.store()
You can use the code below to get the current user's full name:
import com.atlassian.jira.component.ComponentAccessor def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() def fullName = currentUser.displayName
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.