Enter Case number reference for associated cases.

Case #


Type: APM as a Service

Old Article ID: 3228

Old Article Type: howto



Detail the contextual information specific to the issue; i.e. Product, Version, Agent, System, etc.

  • Dynatrace Portal
  • Dynatrace Recorder

Describe the problem, from the user perspective

Setting a script to select a random value from an array.

Clearly list the Steps to resolve the issue

To configure a script to select a random value from an array:

  1. Create your list.
  2. Code a random function call to select one of those values.
  3. Assign the function call to the desired element.

For example:

var myList = new Array("Honda","Toyota","Ford");
var reqValue = myList[Math.floor(Math.random()*3)]
document.getElementById('myCar').value = reqValue

You can use the above code wherever you can use JavaScript in Dynatrace Recorder script.