scriptrunner cloud currentuser

Rudy Holtkamp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 13, 2017

Hi,

I'm using  the cloud versions of JIRA Service desk and Software and want to use the current user as reporter for clone which I'm creating with Scriptrunner. How do I get the current logged in user. It should be so easy, but I googled around and cannot come up with an answer.

 

Thanks

Rudy

1 answer

1 accepted

5 votes
Answer accepted
Jon Bevan [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.
February 14, 2017

Hi Rudy,

In the additionalCode of the Clone Issue post function you'll need this code:

def response = get('/rest/api/2/myself').asObject(Map)
assert response.status == 200

def currentUsername = response.body.name
issueInput.fields.reporter = [name: currentUsername] as Map

Here's a screenshot too:

clone_issue.png

I hope that helps, Jon

Rudy Holtkamp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 14, 2017

Thanks @Jon Bevan [Adaptavist], that is not what I expected, but sure works! It is quite a change going from scriptrunner server to cloud!

 

 

Suggest an answer

Log in or Sign up to answer