Forums

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

plugin not working

gagan m s February 13, 2018

Hello,

i have developed a basic plugin for jira.

however when i load script in to the script file it is not working.

i need to change values of custom field even on pop up using javascript.

my js

JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
alert("Hello!!!");
alert(document.getElementById("customfield_10000"))
document.getElementById("customfield_10000").value = "working";

});

 

my webresource.

<web-resource key="myPlugin-resources" name="myPlugin Web Resources">
        <dependency>com.atlassian.auiplugin:ajs</dependency>
        <context>atl.admin</context>
        <context>atl.general</context>
        <context>atl.popup</context>
        <resource type="download" name="myPlugin.css" location="/css/myPlugin.css"/>
        <resource type="download" name="myPlugin.js" location="/js/myPlugin.js"/>
        <resource type="download" name="images/" location="/images"/>

        <context>myPlugin</context>
    </web-resource>

 

 

1 answer

0 votes
Daniel Wester
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 13, 2018

Is the javascript loading on the page?

If that's the complete javascript - make sure to wrap it with AJS.toInit - so:

AJS.toInit(function()

{

JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
alert("Hello!!!");
alert(document.getElementById("customfield_10000"))
document.getElementById("customfield_10000").value = "working";

});

});

 

Depending on what you're doing - you might want to limit down your context usage (so that you're only included on the pages that you want to be on). You can use Web Fragment Finder to find web resource context.

If you have any more questions - I would suggest asking these types of questions over at https://community.developer.atlassian.com where there are a lot more developers :)

gagan m s February 14, 2018

i made the changes as you specified , but still no luck.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events