# Pass value from javascript to next synthetic event

**URL:** <https://community.dynatrace.com/t/pass-value-from-javascript-to-next-synthetic-event/22557>\
**Category:** Synthetic Monitoring\
**Tags:** browser-monitors, javascript\
**Created:** [November 14, 2019, 12:47pm UTC](https://community.dynatrace.com/t/pass-value-from-javascript-to-next-synthetic-event/22557 "2019-11-14T12:47:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanjiv1987](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@sanjiv1987](https://community.dynatrace.com/u/sanjiv1987)\
**Post date:** [November 14, 2019, 12:47pm UTC](https://community.dynatrace.com/t/pass-value-from-javascript-to-next-synthetic-event/22557/1 "2019-11-14T12:47:11Z")

</div>

Iam currently having a step which generates a random text and populates the value in text field.

But the value is not getting populated in the further pages.

Basically I removed a keystroke step which had a hardcoded value and replaced it with JavaScript code.

I want to pass JavaScript output to “textValue” field for keystroke.

---

<div class="post-metadata">

**Author:** ![Benjamin\_Fellne](https://avatars.discourse-cdn.com/v4/letter/b/96bed5/32.png) [@Benjamin\_Fellne](https://community.dynatrace.com/u/Benjamin_Fellne)\
**Post date:** [November 22, 2019, 9:01am UTC](https://community.dynatrace.com/t/pass-value-from-javascript-to-next-synthetic-event/22557/2 "2019-11-22T09:01:56Z")

</div>

Hi Sanjeev,

you can do this easily by using placeholders.

1. Create a javascript step and use the api to create a new placeholder variable.

```auto
api.setValue("key", "value");

```

2. Use the defined key as a placeholder for fields where its possible to use them like keystroke events.

 ![22534-screenshot-2019-11-22-at-095956.png](https://global.discourse-cdn.com/dynatrace/original/3X/9/d/9d7ed4efced8e3ca5357007661a616318621ef17.png)
