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

script creating issue get "You don't have permission to assign issues"

Hello,

I'm using script runner in post function to create new issue and link it with current working issue. It's strange that I didn't set the assignee in the workflow(new issue creating) but I still get the error "You don't have permission to assign issues". Could you please help with this strange case? Thanks.

 

BR

Xavi

1 answer

1 accepted

0 votes
Answer accepted
Elifcan Cakmak Community Leader Dec 06, 2019

Hello,

Could it be because there is a screen on create transition of the new issue you are trying to create? There may be required fields on these screen like assignee. 

Or there may be a post function that sets the assignee on this create transition. I suggest you check the workflow of the new issue you are trying to create.

Regards,

Elifcan

Thanks Elif. Yes, I've checked the workflow of the new created issue, but the assignee field is not required on the create screen. And for the workflow, I didn't add any post function to set the assignee...Now the workaround is to grant "reporter"  the "assignee issue" permission but this caused some reporters assign the issue to himself during the workflow. Could you please suggest? Thanks again.

BR

Xavi

Elifcan Cakmak Community Leader Dec 09, 2019

Is there a default assignee on the project itself? You can check it on project's settings > Users and Roles. 

Could there be default assignees based on components? You can check it on project's settings > Components.

Could there be a property on the workflow statuses such as jira.permissions.assign.denied ?

This error suggests that somehow there is a rule that when creating a new issue, assignee should be assigned.

Also how exactly are you trying to accomplish this? With a customized script or a built in feature of Script Runner plugin? 

Hello Elifcan,

Thanks for your reply. I've checked all  you mentioned in your answer, no default assignee, no component and no property was set in the workflow. I can create the issue on webUI. The error only occurred when using script runner(post function script) to create issue. The script is as below.

issueInputParameters

.setProjectId(targetProject.getId())
.setSummary(issue.getSummary())
.setDescription(issue.getDescription())
.setIssueTypeId(issueType.getId())
.setPriorityId(issue.priorityId)
.setReporterId(issue.reporterId)
.setSkipScreenCheck(true)

IssueService.CreateValidationResult createValidationResult =issueService.validateCreate(user, issueInputParameters)

if(!createValidationResult.isValid()){

   log.error(createValidationResult.getErrorCollection())
}

This script seems like missing some important parts. Did you copy the whole script? Because there should be an else like this:

else {
issueService.create(user, createValidationResult)
}

Also which user do you use as "user", the logged in user or a static single user or anybody else? 

No, I didn't copy the whole script. I used the below script

if(!createValidationResult.isValid()){

   log.error(createValidationResult.getErrorCollection())
}

else{

  IssueService.IssueResult createResult = issueService.create(user,createValidationResult)
   if(!createResult.isValid()){
     log.error("Error while creating the issue.")
   }

}

and user is used as the logged in user.

ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

Elifcan Cakmak Community Leader Dec 09, 2019

I found a bug report which seems related to your issue? Can you check this out?

https://jira.atlassian.com/browse/JRASERVER-42609

What Jira version are you using? This may be your problem.

Because I couldn't think of any other reason but a bug at this point.

Thanks. I'm using version 7.8.0

Suggest an answer

Log in or Sign up to answer
TAGS

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