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?
I was able to access this using
var projectId = AJS.$("input.project-field")[0].value;
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.
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.