I'm trying to have a script run as the JIRA ScriptRunner user for the "issue updated" event.
However, it will only ever execute as the user initiating, not the ScriptRunner user. I need the ScriptRunner user to execute this script so that I can do a PUT request into a field not visible on the screen.
I first check to see if we're executing as the "ScriptRunner for Jira" for JIRA user and it is not, as can be seen from the logs where I'm logging the "user" variable inside the script.
Any ideas on how to make the ScriptRunner Add-on user run scripts instead of the Initiating user?
Thanks to everyone who got back to me so promptly!
Turns out this was an error on my part. I have written a custom "jira_request" method but was using an older version of the method where I hadn't implemented QueryStrings for PUT requests.
I am still seeing the user in the payload as my user, but the PUT request goes through so I'm not complaining! I actually want to add a catch to stop the script executing if it's not a human user initiating so it works as an advantage to me.
The below logs and payload shows that the PUT request finally goes through with the overrideScreenSecurity QuerySting. However the accountId 5d42.. is my account
Many thanks all,
This is resolved for me.
I use the following in a ScriptRunner script in a Jira Server instance; hopefully it will work for you in the Cloud version.
ApplicationUser jiraAdminUser = ComponentAccessor.getUserManager().getUserByName("jiraadmin")
Hi @Mark O_Shea
Thank you for the question.
The user variable will be logged in user which is here the user which is why you are seeing this. If you configure this as the Add on User, the code will run as this user and you can see this by clicking the "Green" tick in the history section, then to the Payload tab.
Hope this helps.
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events