Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Adding a customized button plugin to Jira Issue Page

Michael Tan January 29, 2020

Hi, I am trying to add a customized button plugin to all my Jira issues. I am new to plugin dev and maven projects.

I have finished making the functionality of the button with JS, which calls Jira Rest API and automatically creates a new issue with some of the fields filled in already.

The button has a client and server side which the client (inside public directory) is triggered to read the issue key on the webpage and call server (index.js), and the server calls the api. I also have another version of the button server which uses Java.

This is the code for the client's side:

document.getElementById("create-test-case-link").addEventListener("click", findTestCase);
async function findTestCase() {
let form = document.getElementById("data-issue-key"); //input of issue key
let issueKey = form.elements[0].value; //getting the issue key from input
const data = {issueKey}; //wrapping issue key as json package to pass to server
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
};
const response = await fetch ('/api', options);
const json = await response.json();
console.log(json); //logging the response from the server
}

2.PNG

Currently I am stuck on how to place the button onto my issue.

I tried to create a Web Item (circle in red) on the issue page, but I don't how to proceed further to "migrate" the code over.

<web-item name="Create Test Case" i18n-name-key="create-test-case.name" key="create-test-case" section="transitions-all" weight="1000"> 
<description key="create-test-case.description">The Create Test Case Plugin</description>
<label key="create-test-case.label"></label>
<link linkId="create-test-case-link">/projects/PLAT/issues/</link>

</web-item>

3.PNG

 

Can someone give my any suggestions on where or how to put my code for the button onto the jira plugin?  Or how to "link" my button code to the web item?

4.PNG

Thanks a lot

1 answer

0 votes
Rajat Keshri
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 2, 2023

I have the same query. I know its been over 2 years, but did you find out a way to do it?

Suggest an answer

Log in or Sign up to answer