Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Unable to set approver in JIRA service desk


I am using JIRA service desk 3.4.3 with JIRA 7.3 and script runner 5.0.14.

I want to set approver automatically on create issue transition. Here is my code. This returns error

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.util.ImportUtils
import com.atlassian.jira.user.util.DefaultUserManager
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserManager
import com.atlassian.jira.component.ComponentAccessor

def userManager = ComponentAccessor.getUserManager()

IssueManager issueManager = ComponentAccessor.getIssueManager();
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField CF = customFieldManager.getCustomFieldObjectByName("Approvers");
def user = userManager.getUserByName("admin")
issue.setCustomFieldValue(CF, user);

I am getting error on creating issues and error logs as follows, I have couple other scriptrunner post functions which work fine with the same version of plugin 


2017-12-19 16:27:41,590 http-nio-8080-exec-9 ERROR a570296 987x199807x1 12p4hbv, /servicedesk/customer/portal/122/create/395 [c.a.j.bc.issue.DefaultIssueService] Error creating issue: com.atlassian.jira.exception.CreateException: Error occurred while creating issue. This could be due to a plugin being incompatible with this version of JIRA. For more details please consult the logs, and see: at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue( at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue( at com.atlassian.jira.issue.managers.RequestCachingIssueManager.createIssue( at com.atlassian.jira.bc.issue.DefaultIssueService.create( at com.atlassian.jira.bc.issue.DefaultIssueService.create( ... 2 filtered at java.lang.reflect.Method.invoke( at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke( at com.sun.proxy.$Proxy110.create(Unknown Source) ... 2 filtered at java.lang.reflect.Method.invoke( at at at at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( at

1 answer

Try calling this at the end of your script:


You'll also need to 

import com.atlassian.jira.event.type.EventDispatchOption


I do something very similar: Here is my code that I got to work on Jira Server 7.5.0


import com.atlassian.jira.ComponentManager
import com.atlassian.jira.project.Project
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.event.type.EventDispatchOption

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
ProjectManager projectManager = ComponentAccessor.getProjectManager()

def customFieldProject = customFieldManager.getCustomFieldObjectByName("Project Selection")
def projectName = issue.getCustomFieldValue(customFieldProject).toString().substring(9)
projectLead = projectManager.getProjectObjByKey(projectName).getProjectLead()


CustomField customFieldApprovers = customFieldManager.getCustomFieldObjectByName( "Approvers" );

issue.setCustomFieldValue(customFieldApprovers, [projectLead])

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

IssueManager issueManager=ComponentAccessor.getIssueManager();


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Staying organized with Jira: best practices for a better project management

Project managers know this problem: A “mountain of work” lays in front of you, and you don’t know how and where to tackle them. Different to-dos lie ahead, but just one task after the other can be ha...

248 views 2 1
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