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
But didnot have any luck with them.
Can someone please help?
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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.
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.