I am trying the following way, but failed :
<web-resource key="view-issue-page-web-resources" name="Web Resources">
<resource type="download" name="viewIssue.js" location="includes/js/viewIssue.js">
<param name="issueId" value="${issue.id}"/>
</resource>
<context>jira.view.issue</context>
</web-resource>
AJS.params.issueId is returning undefined.
How can I get the issue id in the js file?
I think you already know that you can get the project key using
pkey = AJS.$("#key-val").text()
If the key is not sufficient you can the use Ajax to get the rest about the issue (Jira 5 required)
function getIssueByKey(pkey) { var result = null; AJS.$.ajax({ url: "/rest/api/2.0/issue/"+pkey, type: 'get', dataType: 'json', async: false, success: function(data) { result = data } }); return result; }
id = getIssueByKey(pkey).id
But honestly right now i also don't know how to do that easier or for Jira 4, If there is time during the holiday i will look at that closer
Thanks Dieter
But I am already using the one below. I don't want to use the hack method and I want to do it in a standard way and I am not able to find that.
var editButton = AJS.$('#editIssue');
if(editButton){
var href = editButton.attr("href");
if(href.indexOf('?id=') > -1){
issueId = href.substring(href.indexOf('?id=')+4);
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dieter, I am developing a plugin, which has a db table with many to many relationship with JIRA issue id directly. That is the only reason, why I want to use issueId.
One more thing, my problem is still not resolved, because it is possible, that in future versions of JIRA, they change id of html elements. That's why I was asking, is there any standard way of doing that like AJS.params.issueId ?
Anyways Thanks Dieter for the help and quick reply.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.