How to create issues using direct HTML links in Jira Server

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

The Jira functionality described on this page is not maintained as a supported component of Jira applications. Consequently, Atlassian can't guarantee to provide any assistance in configuring or implementing it.

This Jira functionality was disabled in Jira 9+.

We recommend using the Jira REST API instead of following the steps on this page, as the content is now quite outdated. Please see our Jira REST API Tutorials for further information.

(info) Additionally, all recent versions of Jira allow administrators to create Issue Collectors, which replaces the need to construct URLs as instructed in this knowledge base article.

(info) Please Note: Jira 4.1+ now uses form tokens as an additional level of security against cross-site request forgery. See Form Token Handling for details on how your external HTML form will handle form tokens.

If you would like for your users to create issues from another site, you can do so by putting links to your Jira application's create issue page. You can also populate the fields on the page with values to select the project, the issue type, or even the summary of the issue. This document will detail how to construct these links and how to populate the fields. This feature is available from Jira 3.5 onwards.

Note that this only pre-populates the Create Screen with desired values. You will still need to click on the 'Create' button manually to actually create the issue. It's not possible to automatically click/submit using this method.

The most basic HTML link to create issues has the following structure:

Type of issueLink
Regular Issue
<a href="[Jira BASE URL]/secure/CreateIssueDetails!init.jspa?[ARGUMENTS]">[DESCRIPTION]</a>
Sub-tasks
<a href="[Jira BASE URL]/secure/CreateSubTaskIssue!default.jspa?parentIssueId=[PARENTID]">[DESCRIPTION]</a>


where

Component

Description

Example

[Jira BASE URL]

The Base URL of the Jira application you wish to create issues in

http://Jira.atlassian.com

[ARGUMENTS]

List of key-value pairs separated by '&' which represent the field and its value to be set in the create issue screen

pid=10420&issuetype=4

[DESCRIPTION]

The link description visible to users

create an issue in Test Project

[PARENTID]The ID of the parent issue you want to create a sub-task for. Note that you cannot fill in other fields (eg. summary, description) when creating sub-tasks10000

Jira Base URL

This Base URL is the same as the Jira Base URL you wish to create issues in. This can be found in Jira Admin > System > General Configuration > Settings. For example, http://Jira.atlassian.com is the base URL of the Jira application running at Atlassian.

The Arguments

If you need help finding the Project ID or the Issue Key ID, check the following knowledge base articles:


The list of key-value pairs included will define which fields will have what values set. The argument list has the following properties:

  • Each key-value pair is separated by an '&'
    • For Example: '[keyValuePair]&[keyValuePair]&[keyValuePair]'...

  • Each key-value pair has the form 'key=value' where the key is a field name and the value is the desired value to be set for its corresponding field
    • For Example: 'pid=10420&issuetype=1&summary=helloWorld&description=greetings'...

  • The list must comply with HTML link syntax, meaning that all characters must be properly escaped.
    • Characters like space cannot be used directly, they must be encoded (escaped). To use a space, we would replace the space with a '+' or '%20' which is the space equivalent.
      An excellent HTML URL-encoding reference listing all the characters and their corresponding encoded symbol can be found here.
    • For Example: 'summary=This+is+a+summary%20with%20escaped+spaces'

 
As you can see, constructing the argument list is relatively simple. All we need is the name of the fields we want to set values for, and just structure it as above.

Fields that are not set will simply be assigned their normal default values. The issue is not created until the user submits the form, which includes a validation check to confirm the field values are correct.

Finding out the field names and their values


Now that we know how to construct the URL structure for direct issue creation, we need to know how to identify the IDs to be added to it.

The easiest way to achieve this is by creating a "base issue", that is set with all of the values you want to use on the HTML link, and then view the values stored on the JSON representation of the issue by accessing the following REST endpoint:

https://<yourinstanceurl>/rest/api/2/issue/<issuekey>?expand=names
(info) A few helpful notes:
  • Be sure to replace '<yourinstanceurl>' and '<issuekey>' with your instance base URL and the "base issue" respectively.
  • If your URL contains a context path, be sure to also add it to the URL.
  • To facilitate the visualization of the data, you can download an extension to beautify your JSON results. We use JSONView extension for Chrome.

 
Example of how the REST results look like:
Here, the 'issuetype' ID would be '10002', and the project 'pid' would be '10100'.

(plus) Since we've added the '?expand=names' parameter to the URL, we get a helpful translation between the system name for the field and the name that is displayed on the UI at the bottom of the page.


The following table shows a sample list of the standard Jira fields with their name (key), the type of value expected, and an example of the value:

Display Name

Key

Value Type

Value Examples

Project

pid

Project Id

' 10420'

Issue Type

issuetype

Issue Type Id

standard Jira issue type values range from '1' to '4'

Summary

summary

Plain Text

'issue+created%20via+link'

Priority

priority

Priority Id

standard Jira priority values range from '1' to '5'

Due Date

duedate

Date

'15-Dec-2005' - may have a different format depending on your Jira date settings

Components

components

Component Id

'10014'

Affects Version/s

versions

Version Id

'10015'

Fix Version/s:

fixVersions

Version Id

'10015'

Assign To

assignee

Username

'admin' or 'sam@atlassian.com'

Reporter

reporter

Username

'admin' or 'sam@atlassian.com'
To have the reporter field default to the currently logged-in user, the user must be logged in and must not have the Modify Reporter permission.

Environment

environment

Plain Text

'this+is+the+environment'

Description

description

Plain Text

'this+is+the+description'

LabelslabelsPlain Text

Note that, since the Labels field can contain a list of labels, it is possible to add multiple labels using the Create Issue URL. Examples:

  • To only add 1 label, use the following syntax:

    labels=label1
  • To add 2 labels, use the following syntax:

    labels=label1&labels=label2

Custom Fields

The key and value for custom fields can be found in the same way as above. The name/key to be used on the HTML link is prefixed by 'customfield_' followed by their custom field id. For example: 'customfield_10000'

(lightbulb) Please note that when setting values for Custom Fields with defined values (Select List CF) you'll need to apply the option ID to the URL. You can get this ID through the same methods described above, or alternatively pass an 'invalid' value to the URL, and Jira will list you the available options for that custom field. 

For example, by setting '&customfield_10300=xyz' to the URL, Jira will list the proper values when loading the page. After that, you may simply replace it with the correct one, such as '&customfield_10300=10302' if you want to select "Option 3".

ExampleOptionID.png

Examples

Here are some simple examples that provide links to create issues in a Jira project.

To create an improvement issue in the Test project, click
<a href="http://Jira.atlassian.com/secure/CreateIssueDetails!init.jspa?pid=10420&issuetype=4">here</a> 


To create an improvement issue in the Test project, click here

To create a task with summary 'say hello world', click
<a href="http://Jira.atlassian.com/secure/CreateIssueDetails!init.jspa?pid=10420&issuetype=3&summary=say+hello+world">here</a> 


To create a task with summary 'say hello world', click here
To create a task with multiple values selected for a field, click
<a href="http://Jira.atlassian.com/secure/CreateIssueDetails!init.jspa?pid=10420&issuetype=3&summary=say+hello+world&fixVersions=10331&fixVersions=13187">here</a>


To create a task with multiple values selected for a field, click here

A more detailed example to
   <a href="http://Jira.atlassian.com/secure/CreateIssueDetails!init.jspa?pid=10420&issuetype=2&summary=detailed+example
   &description=description+goes+here&components=10240&duedate=7%2dDec%2d2005
   &customfield_10010=this+is+a+custom+field">
   create an issue.</a> Has description, components, due date and a custom field preset.


A more detailed example to create an issue. Has description, components, due date, and a custom field set.
Here is an example to
   <a href="http://Jira.atlassian.com/secure/CreateSubTaskIssue!default.jspa?parentIssueId=86099">
   create a sub-task.</a>. No other fields can be populated.


Here is an example to create a sub-task. No other fields can be populated.



Last modified on Sep 27, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.