How to update Forge UI Issue Panel with JIRA Issue update event listener function?

Dylan Oh
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 14, 2021

We have created an Issue panel on JIRA issue view screen. What we need to render is a list of issue keys (which fetched by an API call). 

This is how we define the Forge library manifest.yml file:

modules:
jira:issuePanel:
- key: dylan-hello-world-app-hello-world-panel
function: main
title: Forge App by Dylan
icon: https://developer.atlassian.com/platform/forge/images/icons/issue-panel-icon.svg
trigger:
- key: issue-updated-trigger
events:
- avi:jira:updated:issue
function: issue-trigger-func
function:
- key: main
handler: index.run
- key: issue-trigger-func
handler: index.issueUpdatedTrigger
app:
id: our cloud app id
name: dylan-hello-world-app
permissions:
scopes:
- read:jira-work

 My run() function does the the rendering part of the panel (initial render).

The issueUpdateTrigger(event, context) function will be triggered when issue updated event happens. By default, this function will automatically received event and context parameters from JIRA.

In the issueUpdateTrigger, we would like to call API again by passing in context to retrieve new issue keys list and also update the context of our existing panel. May I know how can we perform the regarding actions?

(I think It is a must to expose both run() and issueUpdatedTrigger() functions in the index file, cause this is how Forge reads the function, and therefore these two functions might not be able to share a common ancestor function.)

Appreciate your help and do let me know if more information is needed :D

3 answers

1 accepted

0 votes
Answer accepted
MS
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 6, 2021

Hi @Dylan Oh,

I've checked with the team and updating the app's view basing on the trigger state (or updating the trigger basing on the view code) is not possible.

Thanks,

Mateusz

Dylan Oh
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 6, 2021

I see, thanks for helping to reach out, Mateusz.

May we check in this case, is there any function that we can use to force refresh the issue panel inside our event listening function?

MS
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 7, 2021

Unfortunately refreshing the issue panel is not possible inside event listening function. You may provide a button for users to refresh an issue using e.g. useAction https://developer.atlassian.com/platform/forge/ui-kit-hooks-reference/#useaction - when state of the hook is refreshed, the view is re-rendered. 

Thanks,
Mateusz

Dylan Oh
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 9, 2021

Dylan Oh

Hi Mateusz,

I see... thanks for explaining.

We are doing something like an issue panel to display information regarding the ticket, ,and therefore we would require the issue panel to listen for the event of issue updating and not the event that is happening within the app itself (like button onClick).

Can I also check with you is the function below catching JIRA Issue updating event? Because we have tested this for our app but it is not catching event from JIRA when we update the issue.

AP.events.onPublic('customPublicEvent', function(){
alert('public event fired');
});

 Again, appreciate your input!

MS
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 9, 2021

@Dylan Oh

unfortunately currently it's not possible using UI kit. But with CustomUI you can build your own UI with JS and use e.g. some interval polling / checking if the state changed. 

Regarding the code chunk you've pasted - the AP is suggesting you're using the Connect JS API - https://developer.atlassian.com/cloud/jira/platform/about-the-connect-javascript-api/. It doesn't work on Forge.

Thanks,

Mateusz

0 votes
Magnus Anderssen
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 8, 2024

it's 2024 now...

Has this changed ?

Is it still impossible to get updates of current issue in a forge issue panel ?

0 votes
MS
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 1, 2021

Hi @Dylan Oh

 

I'll gather information and we'll come back to you with an answer :) 

 

Thanks,

Mateusz

RichardSefton October 26, 2021

So this comment was an april fools then?

Like # people like this
MS
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 27, 2021
RichardSefton October 27, 2021

apologies. my mistake. ordered latest first. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events