The Adaptavist Group LogoDocumentation

Connect to Jira Using ScriptRunner

Forms for Confluence can be integrated with Jira to create issues automatically when a form is submitted.

This feature is often used to capture bug reports, service requests, or structured feedback directly in Jira, without requiring users to leave Confluence.

This setup has three parts:

  1. Link Confluence and Jira with an application link and configure authentication (both directions).
  2. Create a ScriptRunner REST endpoint in Jira that accepts the form payload and creates issues.
  3. Configure a Form ID in Confluence to send submissions to that endpoint via the application link.

Prerequisites

You'll need administrator access on both Confluence and Jira. Make sure:

  • The base URL is correctly set in each application.
  • Network/firewall allows Confluence ↔ Jira communication.
  • You can log into both apps with an admin account (ideally the same username to streamline link creation).
  • ScriptRunner for Jira is installed and licensed.

Configure Outgoing and Incoming Authentication

Both outgoing and incoming authentication must be configured so Confluence and Jira can call each other.

  1. In Confluence, go to Administration → General Configuration → Application Links .
  2. Click Edit next to the Jira link.
  3. Open the Outgoing drop-down and select OAuth / 2-Legged OAuth (2LO).
    • For creating issues on behalf of the user who submitted the form, use OAuth with impersonation, if available.
    • Otherwise, standard 2LO is fine—your ScriptRunner endpoint can choose a service account.
  4. Open the Incoming drop-down and select OAuth / 2-Legged OAuth (2LO).
  5. Click Save changes.
  6. Verify the same setup is in place on the Jira side for the reciprocal link.
Note: OAuth can be broken when the sever clocks are not correctly synced.

Create a ScriptRunner REST endpoint in Jira

This endpoint receives the form submission and creates the issue. Find more information in ScriptRunner's documentation on REST endpoints.

  1. In Jira, go to Administration → Manage apps (or Add-ons) → ScriptRunner → REST Endpoints .
  2. Click Create Custom Endpoint.
  3. Define the Endpoint name (e.g., receiveFromForms) and Method (POST).
  4. Add Groovy code that:
    • Parses the JSON payload from Forms for Confluence,
    • Maps fields to Jira issue fields,
    • Creates the issue,
    • Returns a message to Confluence.

Example Code

Before applying this example please check and update the following items:

  • The endpoint path will be: /rest/scriptrunner/latest/custom/receiveFromForms
  • The script expects project, summary, and description fields in the JSON body.
  • If your form uses different field names, update either the form field names or the script to match.
Note: If you don't want to hardcode a user, use OAuth with impersonation so Jira creates issues as the submitting user.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueInputParametersImpl
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.json.JsonSlurper
import groovy.transform.BaseScript
 
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response
 
@BaseScript CustomEndpointDelegate delegate
 
receiveFromForms(httpMethod: "POST", groups: ["jira-administrators"]) { MultivaluedMap queryParams, String body ->
 
   def params = new IssueInputParametersImpl()
   def issueService = ComponentAccessor.getIssueService()
   def constantsManager = ComponentAccessor.getConstantsManager()
   def forms = new JsonSlurper().parseText(body) as Map<String,String>
 
   def projectManager = ComponentAccessor.getProjectManager()
   def project = projectManager.getProjectObjByKey(forms.project)
 
 // Get a user who has permissions to create issues
 // This must be changed to an existing user on your instance
   def user = ComponentAccessor.getUserManager().getUserByKey("admin")
   params.setProjectId(project.id)
 // Defines the Type of Ticket to create. Please note all Jira types doesn't support all issue types, that is you can not create a "Bug" in Jira Core.
   params.setIssueTypeId(constantsManager.allIssueTypeObjects.findByName("Task").id)
   params.setReporterId(user.name)
   params.setSummary(forms.summary)
   params.setDescription(forms.description)
 
   def createValidationResult = issueService.validateCreate(user, params)
 assert  !createValidationResult.errorCollection.hasAnyErrors()
 
   def issue = issueService.create(user, createValidationResult).issue
   log.debug "Created issue : ${issue.key}"
 
 return Response.ok("Thanks for creating an issue").type(MediaType.TEXT_HTML).build()
}

Configure the Form ID

Once the application link exists, create or edit a Form ID to send responses to Jira.

  1. Go to Confluence Administration → Forms for Confluence .
  2. Select Add New Form Configuration (or edit an existing one).
  3. Enter a Form ID name that describes the purpose of the integration (e.g., BugReportToJira).
  4. Set the Destination type to ScriptRunner for JIRA.
  5. Choose the Jira application link created earlier from the dropdown.
  6. Enter the ScriptRunner Endpoint that will handle the submission.

    This is where the form's data is posted.

  7. Click Save.

Map form fields to Jira fields

To create a Jira issue the form must contain Form fields that provide the data expected by Jira. At minimum, ScriptRunner endpoints usually require:

  • Project Key: identifies which Jira project the issue will be created in.
  • Summary: a short title for the issue.
  • Description: the main details of the request.

Additional fields can also be mapped, such as priority, components, or custom fields. Make sure your form includes these fields and that they are named consistently within the ScriptRunner script.

Test the integration

Before rolling out the form, create a small test form with only the essential fields ( Summary, Description, Project Key). Submit a few responses and check that issues are created in Jira.

Search documentation

Start typing to search the docs.