Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. import com.atlassian.jira.component.ComponentAccessor
  2. import com.atlassian.jira.user.ApplicationUser
  3. import com.atlassian.jira.issue.customfields.manager.OptionsManager
  4. import com.atlassian.jira.issue.fields.config.FieldConfig
  5. import org.apache.log4j.Level
  6. import org.apache.log4j.Logger
  7. log = Logger.getLogger("com.tvpro.CreateIssue")
  8. log.setLevel(Level.DEBUG)
  9.  
  10.  
  11.  
  12. def linkMgr = ComponentAccessor.getIssueLinkManager()
  13. def issue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("PP1-18713")
  14. log.debug(issue)
  15. def customField = ComponentAccessor.customFieldManager.getCustomFieldObject("customfield_11601")
  16. def valueCF = customField.getValue(issue)*.value
  17. log.debug(valueCF)
  18.  
  19. if ("Моушен" in valueCF) {
  20.  
  21. def issueTypeName = "Task"
  22. def summary = "Groovy Sunday"
  23. def issueService = ComponentAccessor.issueService
  24. def constantsManager = ComponentAccessor.constantsManager
  25. def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
  26. def projectId = ComponentAccessor.projectManager.getProjectByCurrentKey("SDTEST")
  27. log.debug(projectId.getId())
  28. def issueType = constantsManager.allIssueTypeObjects.findByName(issueTypeName)
  29. log.debug(issueType.id)
  30. def reporter = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
  31. log.debug(reporter.getKey())
  32. def priority = constantsManager.priorities.findByName("Major") ?: constantsManager.defaultPriority
  33. log.debug(priority.id)
  34. def issueInputParameters = issueService.newIssueInputParameters().with {
  35. setProjectId(projectId.getId())
  36. setIssueTypeId(issueType.id)
  37. setReporterId(reporter.getKey())
  38. setSummary(summary)
  39. setPriorityId(priority.id)
  40. //setCustomFieldValue("customfield_10704", "value")
  41. }
  42. def validationResult = issueService.validateCreate(loggedInUser, issueInputParameters)
  43. def result = issueService.create(loggedInUser, validationResult)
  44. log.debug(result)
  45. //linkMgr.createIssueLink(issue.id, 22222, 33333, 1, currentUser)
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement