Forums

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

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 Champions.
November 8, 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

1 accepted

0 votes
Answer accepted
Nic Brough -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 Champions.
February 14, 2013

You are correct, it does not log them in any way.

Same for edits and deletes of comments - original text is gone forever (although you do get an email saying "was X, changed to Y" on comment edits)

If you weren't using OnDemand, I'd point at the auditor plugin which does log these events, alongside most of your administration actions. With OnDemand, your only real option is to remove permissions for users to do these things.

0 votes
Renjith Pillai
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 Champions.
February 15, 2013

And also, to prevent the deletion of worklogs, protect them using permissions and allow may only project admins to delete/edit the worklogs.

https://confluence.atlassian.com/display/JIRA/Managing+Project+Permissions

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events