It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Can you create a comment as part of a ScriptRunner Post Function that is owned by the system user?

We can write a Groovy Post Function script to post a comment to an issue based on some triggering event but the owner of the comment is the currently logged in user.

Is it possible to post that comment as a Jira "system" user (for example, "administrator")?

Is that a lot of work to accomplish?

1 answer

1 accepted

0 votes
Answer accepted

Yes you can.  Change the dropdown so the script runs as the Scriptrunner Add-on user account

Thanks, @Randy Ho .

Since I can't find a "Scriptrunner Add-on" account in the User Manager, do you happen to know what the name of the account is?

Is it always there even if I can't find it in User Manager?

Also, do you happen to have a snippet of code to change to that user account?

Ah i missed that you're on server.  I believe you would use:

 

ComponentAccessor.getJiraAuthenticationContext().setLoggedInUser(user);

Pass the user you want to impersonate as the parameter of setLoggedInUser 

Just as a general rule you should avoid using an administrator account.  Setup an account with specific rights/access for the tasks you need to run with it.

Ah, got it.  Thanks, @Randy Ho .

Like Randy Ho likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

The add-in you’ve been waiting for: Jira Cloud for Excel 🙌

Introducing Jira Cloud for Excel Here at the product integrations team at Atlassian, we are thrilled to announce the new Jira Cloud for Excel add-in! This add-in lets you export Jira data directly ...

841 views 5 22
Read article

Community Events

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

Events near you