Generalised External Report Add-in

Sidharth A T
Sidharth A T Posts: 1 Green Ribbon


This article aims at creating a generalized external report browser add-in that can be used to render multiple external reports.

Use Case

Single or multiple external reports need to be rendered in Oracle Service Cloud browser UI using the analytic extension.

Technical Walkthrough

There will be two extensions, a generic analytic one called reportDataListener that requests external JSON response data and renders it in the UI based on the table schema and mapping object. The latter one is a console extension called reportDataProvider, which returns the response data to analytic extension upon invoking.

reportDataListener - generic analytic extension:

Step 1

  1. The table schema JSON file, customTablePackage.json, of analytic extension, needs to be replaced with schema file of use case. Multiple table schemas can be added to this file as required.
  2. Update the configuration file, dataConfiguration.json as per the table schema and response data.  
    1. The configuration file has a property named ‘externalTableDetails’ that has an array of external table properties required for rendering data based on the report opened.
    2. For each report required to be rendered using this extension, need to create a separate object inside that array that contains the table name, the event name that needs to be invoked for fetching the response data, and a mapping object.
    3. The mapping object needs to be updated in which the key corresponds to the table schema column name and value corresponds to the key of JSON response value that needs to be rendered in that column. If the response JSON value has a nested object, give the value of mapping object as key1.key2.key3…keyn
    4. Multiple external tables can be rendered by adding property object specific to each table inside this array.

Step 2:

  1. Once the files are updated upload reportDataListener folder as an analytic extension through add-in manager from the desktop application or extension manager from browser UI with the required extension name.
  2. Once uploaded select index.html as init file as well as select table schema file and updated configuration file.
  3. Provide profile access to this extension as per requirement.

reportDataProvider - console extension:

Step 1:

  1. This extension is used to provide the response data once the event name given in the configuration file is invoked from the analytic extension.
  2. The event will be invoked with an object parameter that contains the report table name, report context type and id, filter details, and mapping object. If the report is rendered inside a workspace, workspace type will also be available inside the parameter object of the event callback function.
  3. A function named ‘fetchExternalJsonData’ is used to fetch the response data which needs to override as per the requirement. In the default case, it's being fetched from a JSON file called responseData.json
  4. Else if the response data need to be filtered after its fetched, the function getFilteredResponseData() can be used for this, which will need to be updated to support the filter of the corresponding report.
  5. The details required for pagination and filter are available inside this function if the endpoint supports server-side filtration.

step 2:

  1. Once the files are updated upload reportDataProvider directory as console extension through add-in manager from the desktop application or extension manager from browser UI with required extension name.
  2. Once uploaded select index.html as init file and provide profile access as required.

Error Handling


 The errors will be shown as pop-up messages. The list of error cases are:

  1. When the configuration file cannot be parsed
  2. When there is a column name or response key mismatch on mapping object
  3. When fetching of response data fails or empty response is received.