Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Use logged-in user as variable

akunnari August 14, 2020

Hello,

 

I'm trying to configure a dropdown-list, which has specific values depending on the user, who opens it. For this I am using the custom field "Database Picker" which uses a SQL query to get the input from a DB, now to my actual question:

 

I need to write some Script via ScriptRunner for this field, with which I am unfamiliar with. How do I use the "logged-in-User" as a variable? Since I need to use it in the SQL query to select the right content for the dropdown-list...

 

Thanks!

1 answer

1 accepted

1 vote
Answer accepted
Will C
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 14, 2020

if you use 

import com.atlassian.jira.component.ComponentAccessor
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

 This will pass you the logged in user as a variable, use .name on the end to pass this variable as a string

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events