How to get site URL to build link to JIRA issue?

Hello,

I writing a Confluence Macro, in my workflow I have the id of a JIRA issue (eg: ABC-1) and I would like redirect user to this Jira issue. I would like use Link UIKit2 component to show the link and redirect user to Jira. I know URL Jira issue are built like that : https://{siteURL}/browse/{jiraKey) For exemple in my case: https://test.atlassian.net/browse/ABC-1

How find siteURL with forge ?

NB: useProductContext hook and view.getContext() are depreciated.

Thx

1 Like

Hello Thibaut,

We had the same issue a long time ago and ends up having to create a resolver to have this info, because it was not in any context. The resolver is more or less doing this:

  const response = await api.asApp().requestJira(route`/rest/api/3/serverInfo`);
  const results = await response.json();
  return results.baseUrl;

But maybe there is a more modern way to get that info.

Hum, I just notice you are in Confluence, them my code don’t apply, sorry.

Funny, just after writing my answer, I stumble on this Jira

Thank you @SilvreLestang I used your workaround.

It would be perfect if baseURL information would be directly output from useConfig() :slight_smile: