AP.events.on where to put it?

Hi guys,
I’m a totally newbie concerning Atlassian development. I wanna create a translate Button. I found issue Content and added the module to my atlassian-connect.json file

{
  "modules": {
    "jiraIssueContents": [
      {
        "icon": {
          "width": 0,
          "height": 0,
          "url": "/my_icon.svg"
        },
        "target": {
          "type": "web_panel",
          "url": "/url_to_panel_content_page.htm"
        },
        "tooltip": {
          "value": "This is a tooltip"
        },
        "contentPresentConditions": [
          {
            "condition": "user_is_admin",
            "invert": false
          }
        ],
        "jiraNativeAppsEnabled": false,
        "name": {
          "value": "My Issue Content Panel"
        },
        "key": "my-issue-content-panel"
      }
    ]
  }
}

afterwards I wanna catch the event with

AP.events.on('ISSUE_QUICK_ADD_CLICKED', function(event){
  AP.dialog.create({
        key: 'sized-panel',
        width: '500px',
        height: '200px',
        chrome: true,
        header: JSON.stringify(event)
  });
});

But where to put it. I put it into index.js but I always get
"ReferenceError: AP is not defined"

Can someone help me out here?

Hi,

AP is an object available in front-end if you include all.js on your web-page.

Cheers,
Jack

And it should be tested on your cloud instance.
AFAIK you can access AP in your local server express / spring boot,
which is tunnelled through ngrok.

Hi @PeterStben ,

In addition to the previous responses, to load all.js, please see https://developer.atlassian.com/cloud/jira/platform/about-the-connect-javascript-api/.

Regards,
Dugald