Using the parameters of invoker.jsp

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.
  1. Go to the Scripts Console.
  2. Select Custom Tools from the drop-down list.
  3. Click New.
  4. Specify the following parameters:
    1. Select input parameters spec: None
    2. Provide the custom tool script name
    3. Select type: ASP/JSP like
    4. 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>
  5. 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.
  1. Go to the Scripts Console.
  2. Select Trigger Script from the drop-down list.
  3. Click New.
  4. Specify the following parameters:
    1. Select input parameters spec: None
    2. Provide custom tool script name, browserTriggerScript.wsp
    3. Select type: ASP/JSP like
    4. 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>
  5. Click Save to save the script.
  6. Run the custom tool script:
    1. Go to Home main menu.
    2. Select My Settings.
    3. Choose the custom tool script from above for the Use a Custom Tool page as the start page field.
    4. Click Save.
    5. 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