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


Create a Tempo Plan when an Issue is Assigned to a User


This script allows you to create Tempo plans for a Jira issue when this issue has been assigned. A Tempo plan is created for each day between the current date, and the due date. The remaining estimate is used as the planned time over the newly created plans. This script uses the Tempo REST Endpoint with basic authentication in the headers of the request. The authenticated user must have permission to view the plans for users; otherwise, the API does not return plans. Read more about permissions in Tempo in this article.


As a project manager, I want to create all plans automatically when an issue is assigned to a user saving me the time of manually setting up plans for each issue in my project. I can use this script to automate the creation of these plans.

Good to Know

  • This script requires Tempo Planner by Tempo for Jira.
  • API request credentials are stored as user properties. This property is named as basicAuthCreds and it contains user and password in the following format: <user>:<password>.
  • For an example of setting/getting user properties, see Library documentation.
  • Set the script listener for the Issue Assigned event, so once a Tempo item is created, updated or deleted, the script is executed.


  • Jira Jira (7.7 - 8.6)
  • ScriptRunner for Jira ScriptRunner for Jira (5.6.14)
import com.atlassian.jira.component.ComponentAccessor import import com.onresolve.scriptrunner.runner.customisers.WithPlugin import import import import import java.time.LocalDate import java.time.format.DateTimeFormatter @WithPlugin('com.tempoplugin.tempo-plan-core') // The user-defined property where the user name and password are stored into final userPropertyKey = 'jira.meta.basicAuthCreds' // Default start time final startTime = '09:00' // Weekends and holidays are not included by default. If a plan needs to be created on weekends and holidays, set this to "true" final includeNonWorkingDays = false final today = def issue = event.issue def endDate = issue.dueDate?.toLocalDateTime()?.toLocalDate() // Do nothing if the issue has been unassigned if (!issue.assignee) { return } if (!issue.estimate || !endDate) { log.error 'Issue has not an estimation or a due date, so the plan cannot be created' return } def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser def credentials = ComponentAccessor.userPropertyManager.getPropertySet(loggedInUser).getString(userPropertyKey) def baseUrl = ComponentAccessor.applicationProperties.getString(APKeys.JIRA_BASEURL) def client = new RESTClient(baseUrl) client.encoderRegistry = new EncoderRegistry(charset: 'UTF-8') client.setHeaders([ Authorization : "Basic ${credentials.bytes.encodeBase64()}", "X-Atlassian-Token": "no-check" ]) client.handler.failure = { HttpResponseDecorator response -> log.error "There was an error creating the plan: ${response.entity.content.text}" [] } client.handler.success = { resp, reader -> [response: resp, reader: reader] } path: '/rest/tempo-planning/1/plan', contentType: ContentType.JSON, body: [ planItemType : 'ISSUE', planItemId :, assigneeKey : 'admin', start : DateTimeFormatter.ISO_LOCAL_DATE.format(today), startTime : startTime, day : DateTimeFormatter.ISO_LOCAL_DATE.format(today), end : DateTimeFormatter.ISO_LOCAL_DATE.format(endDate), includeNonWorkingDays: includeNonWorkingDays, secondsPerDay : issue.estimate ] )
Discovered an issue? Report it here

Suggested for you

Appears in these Collections