How to navigate within a product?

I am trying to find a way to navigate from a Forge issue glance to the issue navigator within Jira and pass the JQL parameter: basically, go to /issues/?jql=${myjql}

Here are the things I have tried:

1. Use a button
I would have preferred to have a Forge UI button with link appearance, but I have not found any way to do this (there is no href prop and with onClick I guess access to window.location or similar is required.

2. Use Text element with format markup
Unfortunately, this approach renders an href pointing to https://issues/?jql=myjql and I am not sure how to get the base URL from the Jira instance in Forge.

<Text format="markup">
    <Link href={`/issues/?jql=${myjql}`}>
        Open in issue navigator
    </Link>
</Text>

3. Use Text element with format markdown
This generally renders the URL correctly (including base URL) but fails because it seems you cannot use template strings when using Markdown format.

<Text>
    [Open in issue navigator](/issues/?jql={myjql})
</Text>

The only way I can think of right now is to fetch GET /rest/api/3/serverInfo which returns the base URL, then assemble the URL and using method 2 - but this feels overkill.

Does anyone know any way to navigate within the product from a Forge app or to get the instance base URL?

Hi @tbinna,

Thanks for bringing this up. Your example for format="markup" should work, but it looks like we’ve recently introduced a regression. Sorry about that!

While we work on fixing that up, you should be able to use markdown format with template strings like so:

  const issueKey = 'ISSU-234';
  return <Text format="markdown" content={`[hey](/browse/${issueKey})`} />;
4 Likes

Thanks, @RyanBraganza, that works indeed and is one permutation that I have not tried yet :+1:

Good to know that it should work with markup too.