Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get currentuser with scriptrunner in jira cloud?

Kedar Kanel
Contributor
August 20, 2024

I want to get the current user using scriptrunner in jira cloud. I want to add in currentuser name in the comment of an issue. But I couldnot figure out how to do so with scriptrunner in jira cloud. I did try

  • currentUser, 
  • executionUser.displayName
  • currentUser?.displayName
  • event.user.displayName

 

But didnot have any luck with them. 

Can someone please help?

3 answers

Suggest an answer

Log in or Sign up to answer
2 votes
Shawn Doyle - ReleaseTEAM
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 20, 2024

This is a 7 year old post, if my time math is correct, but you may give the solution here a try while waiting on Addaptivist 

https://community.atlassian.com/t5/Jira-questions/scriptrunner-cloud-currentuser/qaq-p/7910

2 votes
Dave Rosenlund _Trundl_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 20, 2024

Hi, @Kedar Kanel 👋 

 

I moved your post here, to App Central. This is a better place for this.

That said, you may get to a faster resolution by reaching out to the scriptrunner support team directly:

https://the-adaptavist-group-support.atlassian.net/servicedesk/customer/port

Best,

-dave

0 votes
Sean Chua _Adaptavist_
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 27, 2024

@Kedar Kanel , @Shawn Doyle - ReleaseTEAM is absolutely right..

When you run the listener/script - use Current User. If you use SR add-on, then it will show as SR add-on.....

 

so try:

def response = get('/rest/api/3/myself')
.header('Content-Type', 'application/json')
.asObject(Map)
assert response.status == 200

def currentUsername = response.body.displayName

 then use ${currentUsername} in the comment.

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events