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>
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 :)
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.