You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
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/clone_and_move.py", 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 com.atlassian.jira.issue.link 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)
newissuet.setProjectObject(project)
newissuet.setReporter(curUser)
newissue = im.createIssueObject(curUser, newissuet)
linktype = iltm.getIssueLinkTypesByName('Relates')[0]
r = ilm.createIssueLink(issue.id, newissue.id, linktype.id, 1, curUser)
Any ideas what I should add here?
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events