Missing a way to retrieve the ProductContext when using CustomUI

With UIKit is easy to retrieve the productContext by using the
UIKit useProductContext hook.

What alternatives do you provide when using CustomUI? I am especially interested in retrieving basic info such as issueKey, accountid so that I can use the REST Api.


1 Like

@bjornbrynjar have a looks at Daniel’s comment here on how to return the context from a resolver function:

I was just wondering the same thing and I think there is currently no other way. Something like useProductContext for Custom UI would indeed be very convenient.


Anyone ending up here after March 2021: It seems there is now an easier way to get the product context in Custom UI code.

The Forge Custom UI bridge now exports a view object which has a getContext() function which returns a Promise with the product context.

import {view} from "@forge/bridge";

Unfortunately, this is not yet documented but the console output from the snipped above should give an idea of what you get back.

Example output returned from view.getContext() called from an issue action
	"cloudId": "my-cloud-id",
	"moduleKey": "my-module-key",
	"extensionContext": {
		"issueId": "11425",
		"issueKey": "ENG-90",
		"issueType": "Story",
		"projectId": "10503",
		"projectKey": "ENG",
		"type": "issueAction"
	"extension": {
		"type": "jira:issueAction",
		"issue": {
			"key": "ENG-90",
			"id": "11425",
			"type": "Story"
		"project": {
			"id": "10503",
			"key": "ENG"