I have been using Jython script to create an issue and few sub-tasks but after upgrading from v5.0.7 to 6.1.7 get following error to create a ticket.
Error creating issue: root cause: Traceback (most recent call last): File "", line 16, in TypeError: createIssue(): 1st arg can't be coerced to com.atlassian.crowd.embedded.api.User, String
Here is my jython script
#add all required imports here
from com.atlassian.jira import ComponentManager
from com.atlassian.jira.util import ImportUtils
from com.atlassian.jira import ManagerFactory
from com.atlassian.jira import ManagerFactory
issueManager = ComponentManager.getInstance().getIssueManager()
issueFactory = ComponentManager.getInstance().getIssueFactory()
authenticationContext = ComponentManager.getInstance().getJiraAuthenticationContext()
subTaskManager = ComponentManager.getInstance().getSubTaskManager()
issueObject = issueFactory.getIssue()
issueObject.setProject(issue.getProject())
issueObject.setIssueTypeId("168")
issueObject.setParentId(issue.getId())
issueObject.setPriority(issue.getPriority())
issueObject.setSummary("create sub-task")
issueObject.setReporter(issue.getReporter())
subTask = issueManager.createIssue(authenticationContext.getUser(), issueObject)
subTaskManager.createSubTaskIssueLink(issue.getGenericValue(), subTask, authenticationContext.getUser())
ImportUtils.setIndexIssues(True)
ComponentManager.getInstance().getIndexManager().reIndex(subTask)
ImportUtils.setIndexIssues(False)
The one bold are 16 and 17 lines and not sure why am i getting this error. Any help woul appreciate ?
GPK
Padmesh,
Try replacing authenticationContext.getUser() with authenticationContext.getLoggedInUser() and your scrit should work
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bob,
Thanks for the response. Wondering how user API is related to Jython script which is native in Jira.
Can you help provide more details please ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Padmesh,
Try replacing authenticationContext.getUser() with authenticationContext.getLoggedInUser() and your scrit should work
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
JIRA changed user APIs in 5.2. You will have to upgrade your scripts. Google should help you find related information.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.