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()
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.