Forge Jira Dashboard Background script not loaded

Hi community,
We are trying to implement a Jira Dashboard Background script in our CustomUI app.
In our manifest, we have this:

modules:
  jira:dashboardBackgroundScript:
    - key: bg-script
      resource: main
      resolver:
        function: resolver
  jira:dashboardGadget:
    - key: gadget-key
      title: Our gadget
      description: Gadget description
      thumbnail: https://developer.atlassian.com/platform/forge/images/icons/issue-panel-icon.svg
      resource: main
      resolver:
        function: resolver
      edit:
        resource: main

In our script file, we have:

import { events } from '@forge/bridge';

events.emit('app.data-change', 'initial-data');

events.on('app.request-data', (payload) => {
  console.log('app.request-data called', payload);
  events.emit('app.data-change', 'initial-or-changed-data');
});

Our gadget emits the event when its view page is loaded, like this:
events.emit('app.request-data', {someData: 'whatever data'});

and it is listening for ‘app.data-change’ event like this:

events.on('app.data-change', (payload) => {
    console.log("PAYLOAD", payload);
    setData(payload);
  });

But this interaction never happens.
Could someone please point me what we might have missed?

1 Like

The reason dashboard background scripts don’t work is discussed here:

Dashboard background scripts not loading with Atlassian Connect

Basically, if your app has a dashboard, the background script will only load for dashboards from your app.

Atlassian have an internal issue (ie. we cannot see it or vote on it) here:
ARKEN-1061: Let dashboard background scripts to render without a need to have a gadget present.

2 Likes