<?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 Pre-execution script - set future dates with api in Synthetic Monitoring</title>
    <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Pre-execution-script-set-future-dates-with-api/m-p/175195#M980</link>
    <description>&lt;P&gt;May I know what was wrong with the commented-out lines?&lt;/P&gt;&lt;P&gt;I am trying to set future dates using API, but it will not work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//var curdate = new Date();&lt;BR /&gt;//var arriveDate = curdate.getTime() + 5 * 24 * 60 * 60 * 1000;&lt;BR /&gt;//var departDate = curdate.getTime() + 6 * 24 * 60 * 60 * 1000;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//api.setValue("arrriveDate", api.dateToFormat(arriveDate, "dd/MM/yyyy"));&lt;BR /&gt;//api.setValue("departDate", api.dateToFormat(departDate, "dd/MM/yyyy"));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// below works&lt;/P&gt;&lt;P&gt;api.setValue("arriveDate", "09/11/2021");&lt;BR /&gt;api.setValue("departDate", "10/11/2021");&lt;/P&gt;</description>
    <pubDate>Mon, 01 Nov 2021 04:31:40 GMT</pubDate>
    <dc:creator>elaineong</dc:creator>
    <dc:date>2021-11-01T04:31:40Z</dc:date>
    <item>
      <title>Pre-execution script - set future dates with api</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Pre-execution-script-set-future-dates-with-api/m-p/175195#M980</link>
      <description>&lt;P&gt;May I know what was wrong with the commented-out lines?&lt;/P&gt;&lt;P&gt;I am trying to set future dates using API, but it will not work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//var curdate = new Date();&lt;BR /&gt;//var arriveDate = curdate.getTime() + 5 * 24 * 60 * 60 * 1000;&lt;BR /&gt;//var departDate = curdate.getTime() + 6 * 24 * 60 * 60 * 1000;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//api.setValue("arrriveDate", api.dateToFormat(arriveDate, "dd/MM/yyyy"));&lt;BR /&gt;//api.setValue("departDate", api.dateToFormat(departDate, "dd/MM/yyyy"));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// below works&lt;/P&gt;&lt;P&gt;api.setValue("arriveDate", "09/11/2021");&lt;BR /&gt;api.setValue("departDate", "10/11/2021");&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 04:31:40 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Pre-execution-script-set-future-dates-with-api/m-p/175195#M980</guid>
      <dc:creator>elaineong</dc:creator>
      <dc:date>2021-11-01T04:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: Pre-execution script - set future dates with api</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Pre-execution-script-set-future-dates-with-api/m-p/175264#M982</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/45728"&gt;@elaineong&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nothing seems to be wrong with your lines. Can you try to use api.getValue like below to see the output.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;api.setValue("arrriveDate", api.dateToFormat(arriveDate, "dd/MM/yyyy"));
api.info(api.getValue("arrriveDate"));&lt;/LI-CODE&gt;&lt;P&gt;We have to use&amp;nbsp;&lt;STRONG&gt;api.getValue()&lt;/STRONG&gt; to get the value of the key previously set by &lt;STRONG&gt;api.setValue()&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;AK&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2021 14:44:31 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Pre-execution-script-set-future-dates-with-api/m-p/175264#M982</guid>
      <dc:creator>AK</dc:creator>
      <dc:date>2021-11-02T14:44:31Z</dc:date>
    </item>
  </channel>
</rss>

