# Dynatrace Synthetic Scripting capabilities

**URL:** <https://community.dynatrace.com/t/dynatrace-synthetic-scripting-capabilities/20137>\
**Category:** Synthetic Monitoring\
**Tags:** synthetic-monitoring\
**Created:** [August 25, 2020, 9:38pm UTC](https://community.dynatrace.com/t/dynatrace-synthetic-scripting-capabilities/20137 "2020-08-25T21:38:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RTOWNSEND](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/rtownsend/32/7966_2.png) [@RTOWNSEND](https://community.dynatrace.com/u/RTOWNSEND)\
**Post date:** [August 25, 2020, 9:38pm UTC](https://community.dynatrace.com/t/dynatrace-synthetic-scripting-capabilities/20137/1 "2020-08-25T21:38:00Z")

</div>

Hello everyone.

Need to automatically apply current date to a date field each time my web transaction is re-played. Shown below is the code from dynatrace synthetic script.

I added the following "var date = (today.getMonth()+1)+‘-’+today.getDate()+‘-’+today.getFullYear() to the TextValue field.

Each time web transaction is replayed, the date field is not displaying the current date. I only see the text from the code.

Any help would be greatly appreciated.

I am new to json coding but I am eager to learn!

Thank You!

}, {

“type”: “keystrokes”,

“target”: {

“locators”: [{

“type”: “css”,

“value”: “input[name=\“dos\”]”

}, {

“type”: “dom”,

“value”: “document.forms[\“Form1\”][9]”

}, {

“type”: “css”,

“value”: “.form-control:eq(2)”

}, {

“type”: “css”,

“value”: “#Form1 div:nth-child(5) div:nth-child(2) div:nth-child(2) div:nth-child(3) div:nth-child(2) input”

}, {

“type”: “css”,

“value”: “#Form1 div.panel div.panel-body div.form-horizontal div.form-group div.col-sm-8 input.form-control:eq(0)”

}]

},

“masked”: false,

“simulateBlurEvent”: true,

“description”: “keystrokes on \“dos\””,

“textValue”: “var date = (today.getMonth()+1)+‘-’+today.getDate()+‘-’+today.getFullYear()”

}, {

---

<div class="post-metadata">

**Author:** ![RTOWNSEND](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/rtownsend/32/7966_2.png) [@RTOWNSEND](https://community.dynatrace.com/u/RTOWNSEND)\
**Post date:** [August 28, 2020, 2:26pm UTC](https://community.dynatrace.com/t/dynatrace-synthetic-scripting-capabilities/20137/2 "2020-08-28T14:26:46Z")

</div>

{

“type”: “javascript”,

“wait”: {

“waitFor”: “time”,

“milliseconds”: 2000

},

“description”: “Current\_date”,

“javaScript”: “var rightnow = new Date();\nvar date = \”\" + (rightnow.getMonth()+1) + \“/\” + rightnow.getDate() + \“/\” + rightnow.getFullYear();\napi.setValue(‘date’, date);"

},

 ![1598624712028.png](https://global.discourse-cdn.com/dynatrace/original/3X/c/a/ca9474e6a14afead64c79aa8c40047d7b9600bad.png)

---

<div class="post-metadata">

**Author:** ![Philipp\_Kastner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/philipp_kastner/32/28797_2.png) [@Philipp\_Kastner](https://community.dynatrace.com/u/Philipp_Kastner)\
**Post date:** [September 3, 2020, 12:20pm UTC](https://community.dynatrace.com/t/dynatrace-synthetic-scripting-capabilities/20137/3 "2020-09-03T12:20:32Z")

</div>

Hi Richard,

do you still need help with this? If yes, is the web application you are scripting against public? You should be able to achieve this with a JavaScript event. See [https://www.dynatrace.com/support/help/how-to-use-dynatrace/synthetic-monitoring/browser-monitors/browser-clickpath-events/#javascript-](https://www.dynatrace.com/support/help/how-to-use-dynatrace/synthetic-monitoring/browser-monitors/browser-clickpath-events/#javascript-)

Kind regards,  
Philipp
