Hello everyone,
I am trying to create a new issue by groovy script in post function.
The ticket creator should be a defined "system"-user who has the rights to create tickets.
We include this in the creation, but the current user will continue to be used as ticket creator.
Therefore we get problems with the permissions, because only the system-user has rights for issue create.
Code snipe:
IssueInputParameters issueInputParameters = issueService.newIssueInputParameters();
ApplicationUser system = ComponentAccessor.getUserManager().getUserByKey("system")
issueInputParameters
.setProjectId( issue.getProjectObject().getId() )
.setSummary( "Test" )
.setDescription("Test description")
.setIssueTypeId(issueTypeID)
.setPriorityId(parentPriority)
.setReporterId(reporterID)
.setAssigneeId(assigneeID)
CreateValidationResult createValidationResult = issueService.validateCreate(system, issueInputParameters)
if (createValidationResult.isValid())
{
IssueResult createResult = issueService.create(system, createValidationResult)
if (!createResult.isValid())
{
log.error("Error while creating the issue.")
}
}
Does anyone have any idea?
Thank you and best regards,
Martin
Hi @Martin Wassink ,
I would suggest to change the logged in user at execution time :
ComponentAccessor.getJiraAuthenticationContext().setLoggedInUser(system)
That did the trick for me.
Antoine
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.