<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Http Monitor - Pre Execution Script - Using custom JavaScript in Synthetic Monitoring</title>
    <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Http-Monitor-Pre-Execution-Script-Using-custom-JavaScript/m-p/190337#M1405</link>
    <description>&lt;P&gt;Hi, Please find the details below:&lt;/P&gt;&lt;P&gt;1. I tested the script by passing the API request body in the pre-execution script and it worked fine.&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="100%"&gt;&lt;P&gt;&lt;FONT size="2"&gt;var reqBody = "&amp;lt;api_req_body_json&amp;gt;";&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;request.setBody(reqBody);&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. Now I want to feed an auto generated Id to the request body. As part of that, I've modified the pre-execution script as below and it's failing. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt;: At this point, I'm not passing the Id to the "reqBody" variable. I want to do that once this executes fine.&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="100%"&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;var reandomId = (["DDDDDDDD"]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =&amp;gt; (c ^ crypto.getRandomValues(new Uint8Array(1))[0] &amp;amp; 15 &amp;gt;&amp;gt; c / 4).toString(16));&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;var reqBody = "&amp;lt;api_req_body_json&amp;gt;";&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;request.setBody(reqBody);&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Synthetic Monitor Script Name:&amp;nbsp;&lt;SPAN&gt;Auto Feed ID Testing&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know for more details.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jul 2022 15:09:37 GMT</pubDate>
    <dc:creator>BhanuSarabu</dc:creator>
    <dc:date>2022-07-11T15:09:37Z</dc:date>
    <item>
      <title>Http Monitor - Pre Execution Script - Using custom JavaScript</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Http-Monitor-Pre-Execution-Script-Using-custom-JavaScript/m-p/190283#M1400</link>
      <description>&lt;P&gt;How to use the below javascript statement in a http monitor pre-execution script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var reandomId = (["DDDDDDDD"]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =&amp;gt; (c ^ crypto.getRandomValues(new Uint8Array(1))[0] &amp;amp; 15 &amp;gt;&amp;gt; c / 4).toString(16));&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 02:57:05 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Http-Monitor-Pre-Execution-Script-Using-custom-JavaScript/m-p/190283#M1400</guid>
      <dc:creator>BhanuSarabu</dc:creator>
      <dc:date>2022-07-11T02:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: Http Monitor - Pre Execution Script - Using custom JavaScript</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Http-Monitor-Pre-Execution-Script-Using-custom-JavaScript/m-p/190316#M1401</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do you want to use the variable for? You can have a look at the &lt;A href="https://www.dynatrace.com/support/help/how-to-use-dynatrace/synthetic-monitoring/http-monitors/pre-and-post-scripting-for-http-monitors" target="_blank"&gt;documentation&lt;/A&gt; see what use cases we have for pre-execution scripts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sia&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 10:49:57 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Http-Monitor-Pre-Execution-Script-Using-custom-JavaScript/m-p/190316#M1401</guid>
      <dc:creator>sia_h</dc:creator>
      <dc:date>2022-07-11T10:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Http Monitor - Pre Execution Script - Using custom JavaScript</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Http-Monitor-Pre-Execution-Script-Using-custom-JavaScript/m-p/190333#M1402</link>
      <description>&lt;P&gt;Sia, I want to feed this variable to the request body.&lt;/P&gt;&lt;P&gt;I've referred to the documentation and couldn't figure out how to use this.&lt;/P&gt;&lt;P&gt;Script execution is getting failed.&lt;/P&gt;&lt;P&gt;Here is the link to the Synthetic HTTP Monitor script.&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;lt;Edited to remove the link&amp;gt;&lt;/P&gt;&lt;P&gt;Please check and let me know how to fix this.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 15:12:23 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Http-Monitor-Pre-Execution-Script-Using-custom-JavaScript/m-p/190333#M1402</guid>
      <dc:creator>BhanuSarabu</dc:creator>
      <dc:date>2022-07-11T15:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: Http Monitor - Pre Execution Script - Using custom JavaScript</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Http-Monitor-Pre-Execution-Script-Using-custom-JavaScript/m-p/190334#M1403</link>
      <description>&lt;P&gt;We don't recommend providing links to your monitors/ tenant in the public community. If you would like monitor specific advice I recommend that you open a chat or create a ticket.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That said, you can see the cause of the script failure by checking the vuc-http-execution.log of the ActiveGate that you ran the monitor on. I can see that the failure is due to "Pre script execution failed due to: ReferenceError: \"crypto\" is not defined. "&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 14:25:01 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Http-Monitor-Pre-Execution-Script-Using-custom-JavaScript/m-p/190334#M1403</guid>
      <dc:creator>HannahM</dc:creator>
      <dc:date>2022-07-11T14:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: Http Monitor - Pre Execution Script - Using custom JavaScript</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Http-Monitor-Pre-Execution-Script-Using-custom-JavaScript/m-p/190335#M1404</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/26232"&gt;@BhanuSarabu&lt;/a&gt;&amp;nbsp;, for security reasons, we discourage posting direct links to Dynatrace environments, as this is a public forum. You can read more about it in our &lt;A href="https://community.dynatrace.com/t5/Community-user-guide/Community-guidelines/ba-p/159816" target="_self"&gt;Community guidelines&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;Could you post the screenshot of the script for the Synthetic HTTP Monitor instead?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 14:27:03 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Http-Monitor-Pre-Execution-Script-Using-custom-JavaScript/m-p/190335#M1404</guid>
      <dc:creator>MaciejNeumann</dc:creator>
      <dc:date>2022-07-11T14:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Http Monitor - Pre Execution Script - Using custom JavaScript</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Http-Monitor-Pre-Execution-Script-Using-custom-JavaScript/m-p/190337#M1405</link>
      <description>&lt;P&gt;Hi, Please find the details below:&lt;/P&gt;&lt;P&gt;1. I tested the script by passing the API request body in the pre-execution script and it worked fine.&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="100%"&gt;&lt;P&gt;&lt;FONT size="2"&gt;var reqBody = "&amp;lt;api_req_body_json&amp;gt;";&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;request.setBody(reqBody);&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. Now I want to feed an auto generated Id to the request body. As part of that, I've modified the pre-execution script as below and it's failing. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt;: At this point, I'm not passing the Id to the "reqBody" variable. I want to do that once this executes fine.&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="100%"&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;var reandomId = (["DDDDDDDD"]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =&amp;gt; (c ^ crypto.getRandomValues(new Uint8Array(1))[0] &amp;amp; 15 &amp;gt;&amp;gt; c / 4).toString(16));&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;var reqBody = "&amp;lt;api_req_body_json&amp;gt;";&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;request.setBody(reqBody);&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Synthetic Monitor Script Name:&amp;nbsp;&lt;SPAN&gt;Auto Feed ID Testing&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know for more details.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 15:09:37 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Http-Monitor-Pre-Execution-Script-Using-custom-JavaScript/m-p/190337#M1405</guid>
      <dc:creator>BhanuSarabu</dc:creator>
      <dc:date>2022-07-11T15:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: Http Monitor - Pre Execution Script - Using custom JavaScript</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Http-Monitor-Pre-Execution-Script-Using-custom-JavaScript/m-p/200772#M1590</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/1433"&gt;@HannahM&lt;/a&gt;!&amp;nbsp;Is&amp;nbsp;this some workaround that would be helpful for this case? Thank you for your feedback in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 11:58:09 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Http-Monitor-Pre-Execution-Script-Using-custom-JavaScript/m-p/200772#M1590</guid>
      <dc:creator>Michal_Gebacki</dc:creator>
      <dc:date>2022-12-19T11:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: Http Monitor - Pre Execution Script - Using custom JavaScript</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Http-Monitor-Pre-Execution-Script-Using-custom-JavaScript/m-p/200781#M1592</link>
      <description>&lt;P&gt;If you would like to use the methods from the crypto library, you will need to add them to the pre-execution script, as it has no knowledge of it.&amp;nbsp;You&amp;nbsp;&lt;SPAN&gt;will need to paste all the code you need from the library into the pre/post execution script.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;There is a 50kb size limit for each pre/post-execution script, so be sure to use only the code you need and do a "minimize" on it.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 13:59:31 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Http-Monitor-Pre-Execution-Script-Using-custom-JavaScript/m-p/200781#M1592</guid>
      <dc:creator>HannahM</dc:creator>
      <dc:date>2022-12-19T13:59:31Z</dc:date>
    </item>
  </channel>
</rss>

