Discovery Services Supported Functionality for Calling Web Services

5-28 Oracle Fusion Middleware Integrators Guide for Oracle Business Intelligence Enterprise Edition Figure 5–3 Invoke Java Method EJB Process Flow

5.6.7 Invoke a Browser Script

This action type allows users to browse target JavaScript functions and then create an action to invoke the selected function. For more information about creating this action type in Presentation Services, see Working with Actions in Oracle Fusion Middleware Users Guide for Oracle Business Intelligence Enterprise Edition.

5.6.7.1 JavaScript Functions

Use the following information to help you create JavaScript functions. ■ The target JavaScript functions that Actions to Invoke a Browser Script call are hosted in the UserScripts.js file are found in the following location: middleware homeuser_projectsdomainsbifoundation_domainserversbi_ server1tmp_WL_useranalytics_11.1.1.2.0installation dependent folderwarresb_mozillaactionsUserScripts.js Using Actions to Integrate Oracle BI EE with External Systems 5-29 ■ A sample UserScript.js file can be downloaded as part of the samples for Oracle Business Intelligence 11g from the Oracle Web site. The sample files are located at the following URL: http:www.oracle.comtechnologyproductsbienterprise-edition.html ■ You can edit the UserScripts.js file and add any user-defined JavaScript functions to invoke from a client-side script action. ■ Custom functions should use the namespace USERSCRIPT so that no function name conflicts occur with the product code, and so that the Action Framework can identify functions when creating an action.

5.6.7.2 UserScript.js

Custom functions in the UserScripts.js file consist of a function to contain the actual code to be called when the action is invoked, and, optionally, an associated publish object used by the Action Framework to browse for the function when creating the action and for mapping values to the function parameters.

5.6.7.2.1 JavaScript Example 1 The example shows a JavaScript function of

USERSCRIPT.example_displayParameters that can be called by an action. Target functions receive a single parameter and a named array of values, indexed by the parameter name. This is an example function to display all parameters that are received params {Array} aParams an array of values indexed by the parameter name USERSCRIPT.example_displayParameters = functionaParams { var sArgs = ; for args in aParams { var argName = args; var argValue = aParams[argName]; sArgs += Parameter name: + argName + Value: + argValue; sArgs += \n; } alert sArgs.length == 0 ? No Parameters : sArgs ; };

5.6.7.2.2 JavaScript Example 2 The USERSCRIPT.parameter object is defined at the

beginning of the UserScripts.js file. This object is used by the Action Framework to define parameters in custom JavaScript functions for use when creating an action to Invoke a Browser Script. Each parameter object includes a name, a prompt value holding the text to be displayed against the parameter when creating an action, and a default value. This is the parameter object you can create to supply default parameters on creation of Script action. See the displayParameters example below for usage. param {String} sName is the unique name of parameter. param {String} sPrompt is the display text used to prompt for the parameter value. param {String} sValue Optional is the default value for the parameter. USERSCRIPT.parameter = functionsName, sPrompt, sValue { this.name = sName;