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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

setting a Task when run as "ScriptRunner for Jira" Using the PUT REST API

Murat Seven
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.
Nov 08, 2023

I am creating a task using ScriptRunner for Jira. I want the reporter information of this task to be the person triggering this process, but I should do this while keeping the 'ScriptRunner Add-On User' in the 'Run As' section. I do not want the 'Initiating User'. The script I use for this is as follows. I am looking forward to your assistance on this matter.

 

def issueKey = issue.key
def currentUser = get('/rest/api/2/myself').asObject(Map)
assert currentUser.status == 200
def newReporter = currentUser.body.accountId
logger.info("newReporter: "+ newReporter)

put("/rest/api/3/issue/${issueKey}")
.queryString("overrideScreenSecurity", Boolean.TRUE)
.queryString("overrideEditableFlag", true)
.header('Content-Type', 'application/json')
.body(
fields:
[
reporter: [
accountId: newReporter
],
]
)
.asString()

2 answers

0 votes
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 08, 2023

Hi Murat,

I can confirm that when you run the script as the ScriptRunner add-on user, then this will return this user, and the script will be triggered as this user.

The only way to make it be set to the person who ran the script is to run the script as the initiating user, as the app does not support running as the ScriptRunner add-on user and knowing which user triggered the script.

I hope this information helps.

Regards,

Kristian

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events