How can I assign a default user when creating a new issue so that the history log displays "<default user> created issue"
Actually I was able to resolve the issue myself with the following code..
import com.atlassian.jira.component.ComponentAccessor; import com.atlassian.jira.security.JiraAuthenticationContext; def us = ComponentAccessor.getUserUtil().getUserByName("Anonymous").getDirectoryUser(); def ac = ComponentAccessor.getJiraAuthenticationContext(); ac.setLoggedInUser(us); issue.setReporter(us);
and it functions fine in the Create Issue transition, it is actually the first script to be called in the post functions. The assignment of LoggedInUser solved the issue of creator anonymity in the tabs History and All.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That means you have a real user called Anonymous... that's not quite the same.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually I have to agree...went back and found the method clearLoggedInUser() in JiraAuthenticationContext which I had missed before. I have now just left the Reporter as optional and then set as hidden, in the post function I now just call ac.clearLoggedInUser() and the issue is then actually anonymous.
Thanks for the comment, got me to go back and check again...you could have just pointed out the clearLoggedInUser() method though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I probably would have, but I thought you were happy with your solution. If you want tips, it seems like you use a try/finally block, and replace the actual logged in user. Otherwise I think this user would require to log in again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually the user remains logged in. Also even if I am happy with the solution..I am even happier to find a more correct solution or other options. Also it is helpful for others searching for solutions if an expert points out short-commings or suggests other solutions..so Please comment when you can! Thanks again!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I should have stated my question more clearly. How do I programatically assign the currentUser to a predetermined user ( "defaultReporter" for example ) to really anonymize ticket creation when a logged in user creates a new issue. I am using scriptrunner and a post function/custom script in the create transition.
I can assign a default reporter, but the current user is still visable in the History or All tab of the issue. There it is documented who actually created the ticket. I need the functionallity to work for logged in users.
Thanks..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This means that the Post-function you have put will be ran after the ticket has been created. What you need to do here is to create the ticket not via the post-function. The ticket must be created outside the post-function. You cannot even put your post-function before the "Create the issue" because there's nothing to update if you put that after anything else.
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.
I should have stated my question more clearly. How do I programatically assign the currentUser to a predetermined user ( "defaultReporter" for example ) to really anonymize ticket creation when a logged in user creates a new issue. I am using scriptrunner and a post function/custom script in the create transition.
I can assign a default reporter, but the current user is still visable in the History or All tab of the issue. There it is documented who actually created the ticket. I need the functionallity to work for logged in users.
Thanks..