Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Jython post-function script

I'm currently working on a Jython post-function script that will copy the input of a field (separate Jira project) on a screen from a transition in Service Desk and make a copy of the Jira SD ticket to the selected project. The issue is when the input is left blank (none), it throws the following:

root cause: Traceback (most recent call last): File "/mnt/NewSanDatacenter/jira/jss/jython/workflow/", line 21, in <module> pkey = cfm.getCustomFieldObject('customfield_12019').getValue(issue).getKey() AttributeError: 'NoneType' object has no attribute 'getKey'

The script in question is written in

import com.atlassian.jira.issue;
from com.atlassian.jira.issue import ModifiedValue, DefaultIssueFactory
from import DefaultIssueLinkTypeManager

from com.atlassian.jira.component import ComponentAccessor;
from com.atlassian.jira.util import JiraUtils 

im = ComponentAccessor.getIssueManager();
am = ComponentAccessor.getJiraAuthenticationContext();
pm = ComponentAccessor.getProjectManager();
ilm = ComponentAccessor.getIssueLinkManager()
cfm = ComponentAccessor.getCustomFieldManager();

isf = JiraUtils.loadComponent(DefaultIssueFactory);
iltm = JiraUtils.loadComponent(DefaultIssueLinkTypeManager)

curUser = am.getLoggedInUser()

newissuet = isf.cloneIssue(issue)

pkey = cfm.getCustomFieldObject('customfield_12019').getValue(issue).getKey()

project = pm.getProjectObjByKey(pkey)

newissue = im.createIssueObject(curUser, newissuet)

linktype = iltm.getIssueLinkTypesByName('Relates')[0]
r = ilm.createIssueLink(,,, 1, curUser)

Any ideas what I should add here?

0 answers

Suggest an answer

Log in or Sign up to answer

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