Issue Glance and showing dynamic badge on label

Hi,
I want to show number of new items in issue glance label so that user can decide to expand issue glance if there is any new item. From the documentation I can see that we can add a badge to glance label but it is static. Here is the description of badge from module documentation.

The text to display in the status.
If type is 'badge', this property is a number specified as a string (for example, '3'). Note, this value is static and can only be changed by updating the manifest.

I don’t understand point of static badge. Is there a way to change manifest on the fly so that I can update this number?

You can use an issue property to make it dynamic:

Setting the status for a Glance

The status of a Glance for a specific an issue can be set using the Set issue property API.

The issue property key needs to be formatted as com.atlassian.jira.issue:[addonKey]:[moduleKey]:status to set the status.

The JSON in your PUT request to set the status should follow this format depending on the type of status you wish you display:

  • Lozenge: { type: 'lozenge', value: { label: 'Hello', type: 'default' } } . For available lozenge types, refer to lozenge appearance.
  • Icon: { type: 'icon', value: { label: '/img/tick.png' } } . Note that label is the URL relative to your app’s base URL.
  • Badge: { type: 'badge', value: { label: '123' } } . Note that label must be a numeric string.

https://developer.atlassian.com/cloud/jira/platform/modules/issue-glance/

For more information about setting entity properties: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-properties/#api-rest-api-3-issue-issueidorkey-properties-propertykey-put

Whenever you update the entity property from your code, the change will be reflected in the issue glance.

1 Like

When working with Forge, updating the issue property can either be done within the context of another request (because someone does something within your app that makes the badge change) or periodically by using Forge scheduled triggers (https://developer.atlassian.com/platform/forge/add-scheduled-trigger/).

Alternatively, if your badge needs to be updated because of an external event, you can look into web triggers (BETA): https://developer.atlassian.com/platform/forge/events-reference/web-trigger/

1 Like

Thanks Remie. But I couldn’t get it working. I have set issue property using Paw and I’have checked that it is correctly set. I have used app ID instead of app key, since Forge apps doesn’t have app key.
Additionally Forge documentation clearly specifies that value.label can only be changed by changing app manifest :frowning:

{
  "key": "com.atlassian.jira.issue:ari:cloud:ecosystem:app/a8e8fbf4-8880-4c96-867e-f435099456f1:test-panel:status",
  "value": {
    "type": "badge",
    "value": {
      "label": "123"
    }
  }
}

Ok… yeah sorry, I’m not using Forge so not familiar with these specifics. However, it sounds terribly wrong for a badge value to be static and only adjustable via manifest changes. I would definitely contact the Forge team and raise an issue here because it basically makes the Issue Glance unusable.

1 Like

Much to my disbelief, the Forge issue glance module has indeed been released with a static badge only, which I agree is entirely missing the point of a ‘glance’ into the underlying state. I’ve had a resp. exchange with the team in the decommissioned Forge Slack workspace and apparently got at least across that “adding this capability might be something that Forge can also benefit from” … - you might want to vote for and comment on the resulting issue accordingly:

Given this evasive phrasing and the fact that it has not been addressed for almost a year by now, I somehow doubt the team realized how disconnected their approach “to launch the read-only version first to get developers to start trying it out” has been. Case in point, I haven’t encountered a single use of this ‘feature’, and why would one ever use a static badge indeed?

Anyway, I’ve just commented regarding a third implementation pattern the other week after the Confluence content byline item (which semantically comes closest to the Jira issue glance functionality wise) gained new Dynamic properties, but haven’t received a response yet (to be fair, Forge GA and Marketplace EAP have been the priority initiatives at the time).

3 Likes