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:
- Link Confluence and Jira with an application link and configure authentication (both directions).
- Create a ScriptRunner REST endpoint in Jira that accepts the form payload and creates issues.
- 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.
Create the application link
To allow Confluence to communicate with Jira, you must first set up an application link.
If the application link fails, confirm that:
- The Jira base URL is correct.
- Jira and Confluence are both accessible to each other (e.g. not blocked by firewalls).
- You have administrative permissions in both systems.
Configure Outgoing and Incoming Authentication
Both outgoing and incoming authentication must be configured so Confluence and Jira can call each other.
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.
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.
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.
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.