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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Get issueID in JavaScript in Project Screen (viewing issue)

Hello to all,


I am having a problem where I have no idea where to find a solution or what to search for, so I'm asking this Question. A little context ahead:

I'm writing a plugin that shows some additional information on the ViewIssueScreen. Placing it right on the standard viewing screen for issues (like eg. structure plugin etc.). I use some velocity and JavaScript to postprocess and display some informations. To do that I'm using my own REST Resource which requires the issueID to work with. I could also use the issueKey, but at this point this doesn't change anything or help.

So I found this to get to the issueID (or key) with

 var issueID = JIRA.Issue.getIssueId();
 var issueKey = AJS.$("meta[name='ajs-issue-key']").attr("content");

This all works fine up until this:


When I go to the project of the issue, where all issues that belong to it are listed on the left, and the issue clicked is displayed in a screen right side next to it, it can't retrieve the id or key anymore. It just gives back null and undefined.

How can I get the issueID or issueKey within the ViewIssueScreen where it doesn't matter if its a subpage or not?

1 answer

1 accepted

2 votes
Answer accepted
Mauricio Karas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jun 20, 2018

Hello, Christian. Thanks for reaching out to the Atlassian Community!

I've tried getting the issue key in the issue navigator with the AJS.$("#key-val").text() command but the same behavior happened, it returned null. After some search I was able to find out that it might be because the callback is pointing to the first HTML that rendered which doesn't have the class with the "key-val" id, the problem being the inline editing.

This other question from the Developer Community is describing something similar: Parts of javascript not working in issue navigator

One of the answers suggested is listening to a Jira JS event and then executing the code inside the listener function. I've created the following code and it seems to be working for the purpose of retrieving the issue key.

JIRA.bind(JIRA.Events.ISSUE_REFRESHED, function() {
var key = AJS.$("#key-val").text();
console.log("Issue Key: " + key);

There's further information on extending the inline editing in Jira is this page: Extending inline edit for JIRA plugins

Kind regards,
Maurício Karas

This is likely the most valuable answer I have ever received, thank you very much, also for the quick response. So now I'm calling my setup function from this event bind and pass the issue-key and it works smoothly.

I didn't know about all this inline stuff, this will help a lot in the future too.

So maybe you have time for a little more follow-up questions out of curiosity:

Why is it that always people recommend using the issue-key and never issue-id? I mean if they are both unique, why even bother to have two?

How would I get the ID then? AJS.$('#id-val")?


Best regards,


Mauricio Karas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jun 21, 2018

Glad to hear it worked on your end and that I was able to help.

I don't know exactly why is that the issue key is more used, you're right, they're both unique. I think it's because the issue key is more meaningful than the id, the issue key shows up in the Jira GUI so you can easily find what issue you are referring to.

Yeah, to get the id, the "id-val" doesn't seem to work. If you inspect the issue key next to the project's name you can see rel="<id>", which is the id you want. Another way that I've found, which I can see people using, is the following:


This worked for me and I think is more readable than getting fields and HTML elements.

Kind regards,
Maurício Karas


 This is of course the solution I tried at first (as stated), but this is exactly, where the inline doesn't work anymore. Imho it should still work then.

It's broken for next-gen projects.

Similar way is it possible to get the value for a customfield?

It's broken for next-gen projects.

Is there a solution for next-gen projects in 2023?

Edit: at least the issue is closed, but not solved 

Suggest an answer

Log in or Sign up to answer