Drill Through using JavaScript

You can specify a JavaScript based drill through that enables you to drill through to a graphical user interface instead of an URL. To do this, you write a script in the Script Editor and store it in a custom script directory.

The JavaScript for the drill through is associated with the source adapter. You invoke JavaScript from the drill through link by specifying "#javascript" instead of "http URL" in the source system. You can also pass contextual parameters to a JavaScript function similar to the http drill URL.

To add a drill through using JavaScript:

  1. On the Setup tab, under Register, select Source System.

    See Setting up Source Systems.

  2. Select the source system file for the JavaScript based drill through.
  3. In the detail section, from Drill Through URL, enter #javascript.
  4. Click Save.
  5. On the Setup tab, under Scripts, select Script Editor.
  6. On the Script Editor, click New.
  7. From the Create Script Options window, in Script Type, select Drill.

    Note:

    The Technology drop-down is JavaScript because drill through scripts can only be created based on JavaScript.

  8. In File Name, enter a name for the script.
  9. Click OK.
  10. In Target Application, select the target application for this drill through script.
  11. Write the code for the custom script in the Script Editor.

    Ensure the name of the JavaScript function is same as the file name.

    For example,

    function main($ATTR1$,$ATTR2$){
    var ledger_id = $ATTR2$;
    var currency = $ATTR1$;
    var resp_id = 300;
     if(ledger_id==1)
      resp_id = 100
    else if(ledger_id ==2)
      resp_id = 200
    alert('Currency:' + $ATTR1$);
    alert('ledger_id:' + ledger_id);
    var url = 'http://machinename.us.oracle.com:6362/OA_HTML/RF.jsp?function_id=1045073&CALLING_PAGE=FDM_DRILLDOWN&resp_appl_id=&resp_id=&SOB_ID=1&LED_ID='+ledger-id+'&fdm_per=Jan-03&fdmccid=13098&fdm_currency+'+currency+'fdm_balance_type=A
    alert('url:' + url);
    window.open(url);
    }

    Image shows the JavaScript used in a drill through script.
  12. Click Save.
  13. On the Setup tab, under Register, select Source Adapter.

    See Working with Source Adapters.

  14. In Source Adapter, select the Drill URL tab.
  15. On the Drill URL task bar, select Add.

    Entry fields are displayed for the Drill URL Name, Drill URL, Request Method, and Drill URL Prompt columns.


    Image shows the Drill URL tab.
  16. In Drill URL Name, enter a user defined name for the drill through URL.
  17. In the Drill URL, enter the Function name of the drill through.

    The Function name should be same as the file name.

    For example, enter: main($ATTR1$,$ATTR2$).

  18. In Drill URL Prompt, enter a user-defined prompt for the drill-through prompt.
  19. Click Save.

    When you drill down from the workbench, a new window is launched with the specified URL.