How to Get Current Issue Key in Web Item Provider

jon_d March 10, 2023

I'm trying to build a web item provider that adds a mailto link that includes a link to the current issue.  However I can't seem to access the issue with just "issue" or "event.getIssue()".

 

Is there a way to get the current issue as an object in the web item provider? Thanks!

1 answer

0 votes
Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 10, 2023

Hi @jon_d ,

welcome to the Atlassian community!

In order to retrieve the URL of your ticket based on an event you should use the following portion of code:

String baseUrl = ComponentAccessor.getApplicationProperties().getString(APKeys.JIRA_BASEURL);
String issueKey = event.getIssue().getKey();
String issueURL = baseUrl+"/browse/"+issueKey;

Hope this helps,

Fabio

jon_d March 10, 2023

'event' doesn't seem to be available from the scriptrunner web item fragment scripts.

Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 10, 2023

please let me know what you are trying to do. A webitem is not related to an issue context.

jon_d March 10, 2023

I want a webitem on the action menu for an issue that contains a mailto link with a body parameter that includes a link to the current issue.  But I can't get the webitem to know what the current issue is.

 

Hopefully that clears it up, thanks.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events