Refresh jira:issueContext when users changes workflow

Hi @KamilParzyjaga ,

My understanding is that you want to re-render your app’s jira:issueContext UI after your app’s jira:workflowPostFunction is triggered and performs some operation, presumably on the issue. Let me know if my understanding is not correct.

The events.emit API only works in app front ends implemented with Custom UI. It’s designed to allow your app’s front end components to talk to each other. The jira:workflowPostFunction extension results in the execution of one of your app’s backend functions (ignoring the front end configuration aspects of workflow post functions).

Jira will refresh the issue view under certain circumstances, mainly when another user updates the issue. On the assumption your operation is some action on the issue, then you’ll want to call the Jira REST API from your workflow post function. Within the jira:workflowPostFunction invocation, I believe your app has to invoke the Jira REST API using api.asApp() rather than api.asUser() due to the lack of user context, which means the user that acts on the issue will not be the same as the current logged in user. So I think updates to the issue from the jira:workflowPostFunction should result in Jira refreshing the issue view. I haven’t tested this though.

If the above doesn’t work for you and your jira:issueContext is implemented in Custom UI, then it could poll against the Jira REST API to check if it needs to refresh itself, but this is not an efficient solution, will result in a lot of unnecessary invocations and delays before refreshing. As a result I wouldn’t recommend this pattern.

Regards,
Dugald

2 Likes