Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

script groovy with getissue

we use a script Groovy (plugin Scriptrunner) in Jira 7 to create a new issue from a workflow to an another workflow
we use "import com.atlassian.jira.issue.IssueFactory" like this:
IssueFactory issueFactory = ComponentAccessor.getComponent(IssueFactory)
MutableIssue newIssue = issueFactory.getIssue()
but with Jira 8, the value newIssue returns null.
can you help us please so "issueFactory.getIssue()" works correctly? what shall we modifiy ?

1 answer

0 votes

Hi @linda.zghendy ,

Going by the documentation that seems like it should to be an easy thing.

  • Have you tried wrapping the creation in to a try/catch block to see if it is throwing any exceptions?
  • Does the log show any message when the code is executed?
  • Have you tried just generating an issue thru the script console (without any other actions around it to rule out interference)?

If you can post some more of your script we might be able to see if something else has changed.

Also as a reference you can always look thru for example scripts.

I personally tend to use the IssueManager interface more which allows me to validate the input first before actually running the create.

Hi Dirk, thanks for your answer


here copy from script :

IssueFactory issueFactory = ComponentAccessor.getComponentOfType(IssueFactory.class)


 MutableIssue newIssue = issueFactory.getIssue()


 DefaultIssueChangeHolder issueChangeHolder = new DefaultIssueChangeHolder()

def groupManager2 = ComponentAccessor.getGroupManager()

def group2 = groupManager2.getGroup(groupValue.toString())

CustomField groupeField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_10123")

List<Group> groupList = new ArrayList<Group>()


if (groupeField.getValue(newIssue).equals(null)) {

                log.warn "Creation value groupe Etude"

    groupeField.createValue(newIssue, groupList)








here copy from log error :


2021-10-21 17:27:51,308 WARN [runner.ScriptBindingsManager]: Creation value groupe Etude

2021-10-21 17:27:51,436 ERROR [workflow.AbstractScriptWorkflowFunction]: Workflow script has failed on issue ASK-10516 for user 'S081846'. View here: http://fr-pe-jira-w1:8[...] java.lang.NullPointerException: null value in entry: issue=null




Caused by: java.lang.NullPointerException: null value in entry: issue=null





                at com.atlassian.jira.issue.customfields.persistence.EagerLoadingOfBizCustomFieldPersister.lambda$getValuesForIssueId$1(



Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

335 views 2 7
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