Get Current Issue URL for Script Runner

Joe Charman September 25, 2018

Hi,

 

I am using ScriptRunner to send an email when an issue is created.

 

In the email I would like to add a button which links to the issue, is there something like 

${issue.description}

 

but to obtain the issue URL?

 

Appreciate the help!

Joe

2 answers

1 accepted

12 votes
Answer accepted
Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 25, 2018

Hello @Joe Charman

It should be straightforward, you can get the base URL using

def baseurl = com.atlassian.jira.component.ComponentAccessor.getApplicationProperties().getString("jira.baseurl")

Just append the following to the base_url

complete_URL = base_url + "/browse/" + ${issue.key}

complete URL is the final URL which the end-user can click in the mail and land on the issue.

Joe Charman September 27, 2018

Thank you Tarun,

 

I didn't quite get the base url identifier to work, but it's all fixed as I have used the following instead:


<a href="http://URL/browse/${issue.key}" class="button">View</a>

Which links directly to the issue.

 

Thanks for your help, - Joe

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 27, 2018

Hello @Joe Charman

Glad to know that it's working, please accept/upvote the answer so that others are helped as well.

1 vote
Ramkumar D
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 30, 2020

Try the below code in script console to see the JIRA Base URL value. But you should have Admin privileges.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.properties.APKeys
log.warn(ComponentAccessor.getApplicationProperties().getString(APKeys.JIRA_BASEURL))

Suggest an answer

Log in or Sign up to answer