Heads up! On March 5, starting at 4:30 PM Central Time, our community will be undergoing scheduled maintenance for a few hours. During this time, you will find the site temporarily inaccessible. Thanks for your patience. Read more.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

jira resource folder

gagan m s February 8, 2018

Hello,

im trying to load JS file into the web-resource which is entered in announcement banner.

can anyone tell me how to enter the path of my JS file and also should i include <script> tag and is there a way to get project name or project using js so that i can apply setting only to certain projects.

1 answer

1 accepted

0 votes
Answer accepted
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 8, 2018

Better write an add-on with your JavaScript file. It is not that much difficult.

gagan m s February 8, 2018

how can i do it?

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 8, 2018

Just create a plugin. You can find a tutorial here:

https://developer.atlassian.com/server/framework/atlassian-sdk/create-a-helloworld-plugin-project/

There will be resources in the atlassian-plugin.xml. Add jira.create.issue to the context tag. The context tag defines when your resources will be downloaded. jira.create.issue means that it will be available for the create issue screen. Then you can change your js file which you can find in src/main/resources/js.

Then run

atlas-run 

and try to create an issue. Your js will be downloaded for the screen.

You can find available contexts here:

https://developer.atlassian.com/server/jira/platform/web-resource/

gagan m s February 8, 2018

thank you so much.

i tried creating the plugin its failing to create.

is there no other way other than creating plugin?

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 8, 2018

There is Jsincluder plugin which will let you add your javascript file to the create, edit, view and transition issue screens.

https://marketplace.atlassian.com/plugins/ru.mail.jira.plugins.jsincluder/server/overview

gagan m s February 8, 2018

thanks. you are a life saver.

is there a way to get project key or project name using js so that i can use it in condition?

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 8, 2018

Suggest an answer

Log in or Sign up to answer