I need to get current user in Jira.but i tried few ways but didn't get a solution.
Hello @Ramesh Lakshmanasamy
Did you mean get user in code of some plugins like Scriptrunner?
If you do, you can use
import com.atlassian.jira.component.ComponentAccessor
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
If you write jira plugin
you need to import it directly
@ComponentImport JiraAuthenticationContext jiraAuthenticationContext
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Where are you tryin to get current user?
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.
where you run your class, if you run it in another thread, there are no authentication context so user is null. So you'll need to pass the user as parameter.
Can you provide example of your code?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does anyone know how to get this using Scriptrunner for Jira Cloud?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found 'user' does this so that you can use user.accountId to compare against, but it doesn't seem to work in all contexts like post functions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
How can we get " company name" value of current logged user of jira by using script
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.
How to get the user in a Jira Service that extended from AbstractService and running from Service Scheduler/Cron?
ComponentAssessor.getJiraAuthenticationContext().getLoggedInUser()
always return null.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
just paste this code to the console.
btw this script will just let you know that you are logged in :D
import com.atlassian.jira.component.ComponentAccessor
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
return user
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.