Is there any way to change the "creator" system field using the JIRA JAVA API. The background: the user should be able to create an issue which should be visible as anonymous within the system. So the reporter field can be easily changed during creation to some technical user called "anonymous", but still the "creator" field is set to the current user, who created the issue and this information is visible in the change history.
So one approach would be to change the creator within a post-function, e.g. script-runner, but how?
A solution for changing the Creator field during issue creation would be to switch the AuthenticationContext to the anonymous user within a post-function. This can be implemented by using ScriptRunner and a Custom script post-function with the following code:
import com.atlassian.jira.component.ComponentAccessor def userManager = ComponentAccessor.getUserManager() def user = userManager.getUserByName("<anonymous_username>") def authContext = ComponentAccessor.getJiraAuthenticationContext() authContext.setLoggedInUser(user)
It is very important that this post-function must be executed before the post-function (named: "Creates the issue originally.") which creates the issue.
These can be done in 2 ways:
hi gabrielle, what I need is to update the creator field to a technical user, the creator system field is not equal to the assignee. I understand completely your approaches and they are absolutely fine, but does not macht my use case. The creator field is not visible on the GUI, just in the change history of an issue. BTW, is also not the reporter. See: https://answers.atlassian.com/questions/307400/creator-field
@Tim Eddelbuettel There are multiple solutions to this:
We have used 2) as for our needs it was the best solution.
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG