Simple JS API events query from iFrame to Jira SD Portal

Hi there

I have been (wrecking my head a bit) reading and Googling and disucssing the optioins like crazy on this topic but it seems so confusing OR convoluted. Been going through all of About the JavaScript API as well.

  1. Please advise if annd how we could query events on the Service Desk Portal (form). eg. on select list change or on focus on a text field , etc. and send that event to the iFrame / Connect App?
  2. Please could you eleborate or expand on the JS methods available via the JS API methods. Eg. More on the emit, getSelectedText, on, getContext, etc methods. Some of them return undefined for me and some of them seem confusing as to how to use it. (Grateful for it though)
  3. What is the JIRA and AJS libraries used for? Cloud or Server compatible? Service Desk or Software? How can we use it and what does it provide? …

Thank you in advance
Yatish

Please advise if annd how we could query events on the Service Desk Portal (form). eg. on select list change or on focus on a text field , etc. and send that event to the iFrame / Connect App?

I’m not sure if this is possible or not. You could try registering an event listener in your iframe using onAny/onAnyPublic and see if any events are pushed into your iframe when fields on the portal change.

Please could you elaborate or expand on the JS methods available via the JS API methods. Eg. More on the emit, getSelectedText, on, getContext, etc methods. Some of them return undefined for me and some of them seem confusing as to how to use it. (Grateful for it though)

The methods available on AP.* are provided to allow your app’s iframe and the parent window to communicate with each other. Some of the methods are designed to allow the iframe to request information about the page it’s on (eg. AP.context) and others are designed to allow the iframe to modify the state of the parent page (eg. AP.flag.create). If you could provide some more details on what’s not working for you, (eg. examples that are not behaving as you expect), happy to dig in further.

What is the JIRA and AJS libraries used for? Cloud or Server compatible? Service Desk or Software? How can we use it and what does it provide? …

The JIRA object in the browser is a global object exposing a bunch of helper functions for the Jira front-end. I don’t think this is available within your iframe. The AJS object is the root of the Atlassian User Interface (AUI) library (AUI - Documentation), which you can choose to include in your iframe if you want to use AUI to build your UI elements. Alternatively, you can use AtlasKit (https://atlaskit.atlassian.com/), which is a React-based successor to AUI that implements the latest iteration of Atlassian’s product design

2 Likes

Hi @YatishMadhav ,
one thing I would clarify: Server and Cloud are completely different animals. In particular, the browser-side (JavaScript) APIs are completely different. The only thing they have in common is AUI (the AJS global variable) if you choose to include AUI in your iframe on the Cloud.

On Jira Cloud, there is almost no communication possible between your iframe and the rest of the page - that’s by design, for security reasons.

David