You need to have the values of a few of the parameters
and the different scripts involved in order to call the invoker.jsp.
In the simple example below, the invoker.jsp is called by two different
scripts - a custom tool script and a trigger script.
Procedure
Create and save the invoker.jsp script.
| Option | Description |
|---|
| This script is a custom tool script. It invokes a trigger
script and passes the parameters of the invoker.jsp through the URL. |
- Go to the Scripts Console.
- Select Custom Tools from the drop-down
list.
- Click New.
- Specify the following parameters:
- Select input parameters spec:
None
- Provide the custom tool script name
- Select type:
ASP/JSP like
- Add the following code in the scripts editor:
<HTML> <% user = getCurrentUserName(); %> <SCRIPT language="JavaScript"> window.location= ("/utils/invoker.jsp? company_code=trigo&bUserOutput=false&invoking_user= <%=user %>/trigo&script =browserTriggerScript.wsp"); </script> </html>
- Click Save to save the script.
Note: The
format of using the invoking_user value in the URL is <user_name>/<company_code>.
For example, the user_name=user1 and company_code=trigo, the value
in the URL is user1/trigo.
|
| This script is a sample trigger script, browserTriggerScript.wsp,
that is invoked from the custom tool script. |
- Go to the Scripts Console.
- Select Trigger Script from the drop-down
list.
- Click New.
- Specify the following parameters:
- Select input parameters spec:
None
- Provide custom tool script name,
browserTriggerScript.wsp
- Select type:
ASP/JSP like
- Add the following code in the scripts editor:
<HTML> <HEAD> <title>Test Page</title> </HEAD> <BODY>
User = <%= request["invoking_user"] %>, and getCurrentUserName = <%= getCurrentUserName() %> <% //Verify the user_name that is passed through the URL is correct using the API call getCurrentUserName()
out.writeln("<p>BEGIN TEST<br>"); userName = getCurrentUserName(); companyName = getCompanyName(); out.writeln("User Name: " + userName + "<br>"); out.writeln("Company Name: " + companyName + "<br>"); out.writeln("DONE<br></p>"); %>
</BODY> </HTML>
- Click Save to save the script.
- Run the custom tool script:
- Go to Home main menu.
- Select My Settings.
- Choose the custom tool script from above for the Use
a Custom Tool page as the start page field.
- Click Save.
- Refresh the browser window. You should see the result below in
the display:
User = user1/trigo, and getCurrentUserName = user1.
BEGIN TEST User Name: user1 Company Name: trigo DONE
|