Forums

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

Does Anyone know how to change the run by User, in Script Listeners?

Thanh June 20, 2023

Does Anyone know how to change the run by User, in Script Listeners?

Because in Scheduled Jobs you can choose, who to use and not only the current user or the ScriptRunner Add-On User. (-> Is changing the Name of the Add-On User possible?)

Or is there a way to run scheduled Jobs more frequently than every hour?

Is it possible to modify Scripts using the expression "0 0/30 * 1/1 * ? *" similar to Jira Server?

2 answers

1 vote
Evgenii
Community Champion
June 20, 2023

You can use such script: 

ApplicationUser user = userManager.getUserByName(username) as ApplicationUser

ComponentAccessor.jiraAuthenticationContext.setLoggedInUser(user)

 

Made a small repo with examples, and classes with basic functions. You can look if you like

https://github.com/Udjin79/SRUtils

 

UPD.

Oh, it's Cloud, sorry, my solution won't work, I have to adapt it to Cloud SR, if it's possible, of course :(

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
July 22, 2023

Hi @Thanh

To answer your question, for cloud this is not doable.

When using a listener in the cloud, you have 2 options to set the user, i.e. via the As This User List. In the list, you have 2 options, i.e. either the Current User or the ScriptRunner Addon User.

There isn't any custom script for this at the moment.

Thank you and Kind regards,

Ram

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD Trial
TAGS
AUG Leaders

Atlassian Community Events