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!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

JIRA Scriptrunner access URL


I was wondering if it's possible to get the full URL for the JIRA create issue page from inside Scriptrunner. At the moment I'm able to get the jira.base url from the ApplicationProperties using the ComponentAccessor.

Ideally, I'd like to get the full url, including any arguments contained within the URL. Does another application property or any other component accessor expose this information?

What I'm trying to do is populate some values in a JIRA issue on the create screen using the behaviours part of Scriptrunner. The user will be taken to JIRA with a parameterised URL which fills out some of the fields such as summary, passed in as args.

However, the URL also contains an id field as an argument which I'm hoping Scriptrunner can extract from the URL and then use to poll an API to populate other fields on the create issue page.



1 answer

0 votes

Since you're working with Behaviours, there's a variable in the binding for the current request. It's an HttpServletRequest object. Inside your Behaviour's Groovy script, you could get the URL as a string using


You could then parse that URL string and retrieve its query parameters using normal Java methods. See the answers at for some examples.

You may also want to take a look at the Create Constrained Issue functionality in ScriptRunner.

When I tried this I didn't get the URL of the browser like I was after:

I instead got the path to the scriptrunner behavior validator :

any way to get the former?

@JamieA : this might solve some big issues a number of us are having..this could be a simple way to get a clickable URL to land me on a serviceDesk request form with some of the fields pre-filled.   In truth, what I want is the first page on a service desk portal entry box a person to type in their issue, it does the search, you dont see a match in the KB articles so you click a request type and DANG, I have to type that sentence in again as the summary.  BUT! if you see the URL on the request form it's got those words...embedded as a query param like "q=my+issue+is+about+this..." so ScriptRunner behaviour may conceivably pull it out and stick it in the summary line?   This can also enable a host of other applications to redirect troubles to some requestTypes with a number of pre-fills

Hi @Jonny Carter have you tried the above?  Is it maybe the fact that it's the ServiceDesk behavior that is behaving differently? 

Hey, @Matthew Page -

So, my bad on suggesting you use the request URL. I ought to have realized that the request would be to the Behaviours endpoint, _not_ the create issue page. My bad!

While I do suspect you could construct the service desk URL within the Behaviour, I am beginning to think that maybe Behaviours aren't the right thing for your particular use case. While Behaviours can pull things from form fields, they can't get the URL from the current context.

The only way I can think to get the URL using ScriptRunner at present would be via some custom JavaScript using a Web Resource.

The code below, for example, would get the query string:

const url = new URL(window.location.toString());
const params = new URLSearchParams(;
const query = params.get('q');

Of course, writing the JS to then update the summary field and so forth would take further doing. Also, your mileage may vary on using the above URLSearchParams API.

I'm mulling over whether there isn't a feature request here. Let me get back to you...

Hey all, you could try the following workaround. Not neat but should do the trick: 

def currentURL = ""

def headerNames = request.headerNames
def headerNamesList = []
while (headerNames.hasMoreElements()){

if (headerNamesList.contains("referer")) {
    currentURL = request.getHeader("referer")

// the rest of the code here

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events