It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Cant import JS in Jira plugin

Hello!

I've been trying to develop a simple plugin that uses a JS code to do some things.

Unfortunately i can't import the JS in the velocity file.

I'm using a web resource component:

<web-resource name="Button Resources" i18n-name-key="button-resources.name" key="button-resources">
<description key="button-resources.description">The Button Resources Plugin</description>
<resource name="ButtonJS" type="download" location="js/button.js"/>
<dependency>confluence.web.resources:ajs</dependency>
</web-resource>

 And i have a very simple script to test located in /my-plugins/button-test/plugin/src/main/resources/js:

//button.js
<script>
alert("asd");
</script>

finally, in my velocity file i have the following code:

$webResourceManager.requireResource("com.example.plugins.tutorial.tutorial-jira-add-content-to-view-issue-screen-mine:button-resources")


<button id="issue-btn" class="aui-button">Exportar</button>

The button shows correctly, but the alert does not appear.

Am i doing something wrong?

Thank you in advance.

1 answer

0 votes
Dario Atlassian Team Oct 25, 2019

Hi @Angel Peña ,

I may not the best person to ask this question, but I believe the same topic has already been discussed in the below Community threads and external links:

You may want to review the above links to see if in there you can find the answer to your question. 

Otherwise, in case you don't find anything useful in the provided links and you don't manage to get any other reply in the next days, I would advise to refer to the resources listed in https://developer.atlassian.com/resources:

 

I hope this helps.

 

Cheers,
Dario

Thank you!

I tried the links you provided, but unfortunately, i could not solve my issue.

I'll proceed to create a question in the developers community.

Greetings.

Dario Atlassian Team Oct 31, 2019

You are very welcome @Angel Peña!

Also, if you have time, once you will get your question answered in one of the other resources please paste the solution in here as well.

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

303 views 1 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you