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

I need to set Sub task assignee by jython script to a crowd user, like (user1)

CCP TechOps July 30, 2014

I tried below script for that, its able to create sub task but not getting assinged to a user

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()

issueObject3 = issueFactory.getIssue()
issueObject3.setProject(issue.getProject())
issueObject3.setIssueTypeId("7")
issueObject3.setParentId(issue.getId())
issueObject3.setPriority(issue.getPriority())
issueObject3.setSummary("RDKSEC_Arrisxb3")
issueObject3.setReporter(issue.getReporter())
subTask3 = issueManager.createIssue(authenticationContext.getLoggedInUser(), issueObject3)
subTaskManager.createSubTaskIssueLink(issue.getGenericValue(), subTask3, authenticationContext.getLoggedInUser())
ImportUtils.setIndexIssues(True)
ComponentManager.getInstance().getIndexManager().reIndex(subTask3)
ImportUtils.setIndexIssues(False)

I tried adding a line like

issueObject3.setAssignee(issue.setAssignee(user1))

but its not working and throughing error saying not able to find user1

do i need to import some crowd user model or i need to tweek script? Please help.

4 answers

0 votes
CCP TechOps August 17, 2014

Thanks Alexey it works very well :-)

0 votes
CCP TechOps August 17, 2014

Thanks Alexey it works very well :-)

0 votes
CCP TechOps July 31, 2014

Thanks Alexey it works very well :-)

0 votes
Alexey_Rjeutski__Polontech_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 31, 2014

if you want to provide username only - try to set

https://docs.atlassian.com/jira/6.2.7/com/atlassian/jira/issue/MutableIssue.html#setAssigneeId(java.lang.String) during creation of issue

issueObject3.setAssigneeId("user1"); (java-style, set syntax according to language)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events