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 Jira Project When a Confluence Space is Created


Confluence and Jira can be related to one another through application links. With linked instances, you can perform actions in Jira by running scripts from Confluence and vice-versa. Use this script to create a project in Jira when a Confluence space is created.


I am a technical writer using Confluence to publish documentation for several software projects. Each documentation set is stored in a corresponding space. Using this script, I can create a new project in the linked Jira instance every time I create a new space in Confluence, saving me the time of manually creating Jira projects for each new documentation set.

Good to Know

  • Create an application link to link Jira and Confluence.
  • Associate this script with the SpaceCreateEvent event listener.


  • Jira Jira (7.7 - 8.6)
  • Confluence Confluence (6.6 - 7.10)
  • ScriptRunner for Jira ScriptRunner for Jira (5.6.14)
  • ScriptRunner for Confluence ScriptRunner for Confluence (6.21.0)
import com.atlassian.applinks.api.ApplicationLinkService import com.atlassian.applinks.api.application.jira.JiraApplicationType import import com.atlassian.sal.api.component.ComponentLocator import import import import groovy.json.JsonBuilder import static // Get required components def appLinkService = ComponentLocator.getComponent(ApplicationLinkService) def appLink = appLinkService.getPrimaryApplicationLink(JiraApplicationType) def applicationLinkRequestFactory = appLink.createAuthenticatedRequestFactory() def _event = event as SpaceCreateEvent def space = // Define the request body to creta a new project def input = new JsonBuilder([ projectTypeKey : "business", projectTemplateKey: "com.atlassian.jira-core-project-templates:jira-core-task-management", name :, key : space.key, lead :, ]).toString() // Create and execute the request def request = applicationLinkRequestFactory.createRequest(POST, "/rest/api/2/project") .addHeader("Content-Type", "application/json") .setEntity(input) request.execute(new ResponseHandler() { @Override void handle(Response response) throws ResponseException { if (response.statusCode != 200) {"Jira project successfully created") } else { log.error("Creating Jira project failed: ${response.responseBodyAsString}") } } })
Discovered an issue? Report it here

Suggested for you