Adding a Scripted Custom Field affecting Create Issue in JIRA

I just added a Scripted Custom Field in JIRA with the following script:

import com.atlassian.jira.component.ComponentAccessor

def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def issueLinks = issueLinkManager.getInwardLinks(issue.id)

def subElements = issueLinks.findAll {
    it.getIssueLinkType().getName() == "Dependency"
}

return subElements.size()

After adding the script when I tried to create a issue, I got the following error:

Error creating issue: 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: http://confluence.atlassian.com/x/3McB</span<>>

When I disbaled the Script Runner Plugin / Deleted this scripted field, the error no longer came up and I could create issues. I am using the latest version fo the Script Runner Plugin (2.1.15).

Does anyone know what the issue might be ?

2 answers

This widget could not be displayed.

the problem should be this issue.id as you mention the problem getting during create operation, during create operation you can get only issue object whic does't have id or key.

so put some condition like this

if(!issue.id){

defissueLinks = issueLinkManager.getInwardLinks(issue.id)

}

This widget could not be displayed.

Hi Sweta, which JIRA version are you using?

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

281 views 5 0
Join discussion

Atlassian User Groups

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!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you