You can now vote for scripts to help people know if they're useful or not. Login or create an account to vote!


Automate the Creation of an Issue in Jira


This script saves you the time and effort of creating issues manually. You can add this script to anywhere in Jira that allows you to add a custom script e.g. listeners, workflow functions, REST Endpoints. You can either add this as a standalone script or as part of a larger script to create some serious automation!


I am a product manager, and I need to create several issues weekly for different departments. For example, I need marketing to provide me with a weekly analytics report for live product campaigns. Previously, I was having to spend time every week manually assigning these issues. However, with this script, I can schedule the issues to be created automatically every week.

Good to Know

  • If the reporter user does not exist, it's assigned to the logged in user.
  • Issue type defined must exist in the project.
  • (Server) If priority defined does not exist, it takes the project default priority.
  • (Cloud) If priority defined does not exist, it takes the first priority that the 'priority' endpoint returns.


  • Jira Jira (8.0 - 8.14)
  • ScriptRunner for Jira ScriptRunner for Jira (6.18.0)
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.context.IssueContext import com.atlassian.jira.issue.context.IssueContextImpl import com.atlassian.jira.issue.fields.config.manager.PrioritySchemeManager // the project key under which the issue will get created final projectKey = 'TEST' // the issue type for the new issue final issueTypeName = 'Bug' // user with that user key will be the reporter of the issue final reporterKey = 'auser' // the summary of the new issue final summary = 'Groovy Friday' // the priority of the new issue final priorityName = 'Major' def issueService = ComponentAccessor.issueService def constantsManager = ComponentAccessor.constantsManager def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser def prioritySchemeManager = ComponentAccessor.getComponent(PrioritySchemeManager) def project = ComponentAccessor.projectManager.getProjectObjByKey(projectKey) assert project : "Could not find project with key $projectKey" def issueType = constantsManager.allIssueTypeObjects.findByName(issueTypeName) assert issueType : "Could not find issue type with name $issueTypeName" // if we cannot find user with the specified key or this is null, then set as a reporter the logged in user def reporter = ComponentAccessor.userManager.getUserByKey(reporterKey) ?: loggedInUser // if we cannot find the priority with the given name or if this is null, then set the default priority def issueContext = new IssueContextImpl(project, issueType) as IssueContext def priorityId = constantsManager.priorities.findByName(priorityName)?.id ?: prioritySchemeManager.getDefaultOption(issueContext) def issueInputParameters = issueService.newIssueInputParameters().with { setProjectId( setIssueTypeId( setReporterId( setSummary(summary) setPriorityId(priorityId) } def validationResult = issueService.validateCreate(loggedInUser, issueInputParameters) assert validationResult.valid : validationResult.errorCollection def result = issueService.create(loggedInUser, validationResult) assert result.valid : result.errorCollection
Discovered an issue? Report it here

Suggested for you

Appears in these Collections