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

Get Project ID from Quick Create Issue Dialog JavaScript

We are using the Scriptrunner plugin and would like to have a Javascript fragment that needs to get the Project ID of the selected project on the quick create issue dialog window. We have gotten the fragment to run on this window but are having trouble getting the project ID. What is the best way to access this?

2 answers

1 accepted

0 votes
Answer accepted

I was able to access this using

var projectId = AJS.$("input.project-field")[0].value;
0 votes

Examine the elements in the developer panel of your browser with the Quick Create issue dialog open. Search for the project key you've selected.

You should find that there is a hidden form field title projectKeys

I think should be able to fetch it with

var pkey = $('input[title="projectKeys"]').val()

Oh wait, you wrote project id.

That might be harder, but you can try the same steps.

In my case, I could find a project id value here:

var pkey = $('#project').val()

When all else fails and you need an attribute that's not available when you need it, you can create a new "web panel" fragment. This will let you write a bit of groovy and you can output a meta tag like <meta name="mycustomMetaTag" content="somevalue from groovy">.

Then you can set the context and location of when this gets outputted and read it with javascript.

Suggest an answer

Log in or Sign up to answer

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