Setting parameters

Parameters are special script-level variables that you can define in the Recorder and can then later modify in the Dynatrace Portal. After you create the parameters in the Recorder and then upload the script to the Dynatrace Portal, you can then modify the values of the parameters globally and by node.

Refer to the online help in the Dynatrace Portal for more information about changing the value of parameters in the Dynatrace Portal.

The process to set parameters is:

  1. Record the script and make sure that the script plays back successfully.

  2. Define the parameters in the script.

  3. Use the parameters.

Defining parameters

Define a parameter by entering the value that you entered when the script was recorded and by providing a descriptive name to identify the parameter within the Recorder and in the Dynatrace Portal. For example, you may have originally recorded a script with an account number of 12345. After the recording is complete, you can specify a parameter that has the value of 12345 and the descriptive name of Account Number.

Parameters are defined at the script level:

  1. Select Script .

  2. If the script settings tabs are not displayed, click right arrow below the timeline to display the script settings.

  3. Select the Parameters tab.

Add parameters

  1. Click located to the far right to display fields for the new parameter.
    Parameters tab

  2. Enter the name and value.

  3. Repeat to create new additional parameters.

Delete parameters

  1. Click to the right of the parameter to delete.

  2. Repeat for all the parameters to delete.

Using parameters

After you define the parameter, it can be accessed by the parameters object in a Custom action. For instance, using the Account Number example described above, you can define the following:

document.forms['form1].elements["accountNum"] = parameters["Account Number"];

In addition, you can use parameters in any text field in any action in the script by using evaluation syntax. Evaluation syntax causes the text to be evaluated at runtime. To use evaluation syntax, surround any text with backticks ( ` ). You can enter any valid JavaScript between the backticks. This syntax is commonly used in FormFill actions, as they enable you to set the value of any form element on a page.

To use a Form Fill action with parameters, add the action to the script in an appropriate place and define the target window and locator (as described in Element locators). In the Value field, use the following syntax to define the parameter in the Value field:

`parameters["ParameterName"]`

Using the Account Number example, enter the following in the Value field:

`parameters["Account Number"]`

After you define a parameter, you can have the Text (for Type actions) and/or Value (for FormFill actions) fields automatically populated with the appropriate syntax for using a parameter.

Specify parameter syntax

  1. Click Apply Parameter located next to the Text field (for Type actions) or Value (for FormFill actions). The possible parameters appear in a drop-down list.

  2. Select the parameter to apply. The parameter syntax for the selected parameter appears in the Text field.