<?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>question Include Third Party Javascript Library in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/include-third-party-javascript-library/m-p/1926602#M583528</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once again im bitten by DataTime issues. Can I include a third party jacascript lib in service now and then use it in Transform Map. If yes please share the procedure.&lt;/P&gt;&lt;P&gt;For example if i want to include &lt;A title="mentjs.com/timezone/" href="http://momentjs.com/timezone/"&gt;Moment Timezone &amp;nbsp; &lt;/A&gt; in service now is it possible? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. the format i am trying to parse is &lt;STRONG&gt;07/16/15 16:22:05&lt;/STRONG&gt; which gives me &lt;EM&gt;&lt;STRONG&gt;exception&lt;/STRONG&gt;&lt;/EM&gt;. Target format in which i want it to be is &lt;STRONG&gt;2016-07-07 20:04:27&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code that i tried&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;var sourceTime = '07-16-15 16:22:05';&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;var gd = new GlideDateTime(sourceTime);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;gd.setValueUTC(sourceTime, "MM-dd-yyyy HH:mm:ss");&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;var test = gd.getValue();&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;gs.print(test);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;Exception:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: monospace; font-size: medium;"&gt;Evaluator: java.lang.RuntimeException: '07/16/15 16:22:05' could not be parsed using format string 'yyyy-MM-dd HH:mm:ss' :Unparseable date: "07/16/15 16:22:05" Caused by error in script at line 3 1: var sourceTime = '07/16/15 16:22:05'; 2: var gd = new GlideDateTime(sourceTime); ==&amp;gt; 3: gd.setValueUTC(sourceTime, "yyyy-MM-dd HH:mm:ss"); 4: var test = gd.getValue(); 5: gs.print(test); 6: com.glide.glideobject.GlideDateTime.setValueUTC(GlideDateTime.java:255) sun.reflect.GeneratedMethodAccessor1949.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.mozilla.javascript.MemberBox.invoke(MemberBox.java:138) org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:292) org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2577) org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42) org.mozilla.javascript.gen.null_null_10905._c_script_0(null.null:3) org.mozilla.javascript.gen.null_null_10905.call(null.null) org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:560) org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3439) org.mozilla.javascript.gen.null_null_10905.call(null.null) org.mozilla.javascript.gen.null_null_10905.exec(null.null) com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:236) com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:107) com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:73) com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:322) com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:283) com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:254) com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:242) com.glide.processors.ScriptProcessor.evaluateScript(ScriptProcessor.java:320) com.glide.processors.ScriptProcessor.runScript(ScriptProcessor.java:215) com.glide.processors.ScriptProcessor.process(ScriptProcessor.java:173) com.glide.processors.AProcessor.runProcessor(AProcessor.java:412) com.glide.processors.AProcessor.processTransaction(AProcessor.java:187) com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:165) com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:49) com.glide.sys.ServletTransaction.run(ServletTransaction.java:34) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) java.lang.Thread.run(Thread.java:745) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i am doing it wrong please suggest.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jul 2016 00:10:31 GMT</pubDate>
    <dc:creator>thisisauniqueus</dc:creator>
    <dc:date>2016-07-07T00:10:31Z</dc:date>
    <item>
      <title>Include Third Party Javascript Library</title>
      <link>https://www.servicenow.com/community/developer-forum/include-third-party-javascript-library/m-p/1926602#M583528</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once again im bitten by DataTime issues. Can I include a third party jacascript lib in service now and then use it in Transform Map. If yes please share the procedure.&lt;/P&gt;&lt;P&gt;For example if i want to include &lt;A title="mentjs.com/timezone/" href="http://momentjs.com/timezone/"&gt;Moment Timezone &amp;nbsp; &lt;/A&gt; in service now is it possible? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. the format i am trying to parse is &lt;STRONG&gt;07/16/15 16:22:05&lt;/STRONG&gt; which gives me &lt;EM&gt;&lt;STRONG&gt;exception&lt;/STRONG&gt;&lt;/EM&gt;. Target format in which i want it to be is &lt;STRONG&gt;2016-07-07 20:04:27&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code that i tried&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;var sourceTime = '07-16-15 16:22:05';&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;var gd = new GlideDateTime(sourceTime);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;gd.setValueUTC(sourceTime, "MM-dd-yyyy HH:mm:ss");&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;var test = gd.getValue();&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;gs.print(test);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;Exception:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: monospace; font-size: medium;"&gt;Evaluator: java.lang.RuntimeException: '07/16/15 16:22:05' could not be parsed using format string 'yyyy-MM-dd HH:mm:ss' :Unparseable date: "07/16/15 16:22:05" Caused by error in script at line 3 1: var sourceTime = '07/16/15 16:22:05'; 2: var gd = new GlideDateTime(sourceTime); ==&amp;gt; 3: gd.setValueUTC(sourceTime, "yyyy-MM-dd HH:mm:ss"); 4: var test = gd.getValue(); 5: gs.print(test); 6: com.glide.glideobject.GlideDateTime.setValueUTC(GlideDateTime.java:255) sun.reflect.GeneratedMethodAccessor1949.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.mozilla.javascript.MemberBox.invoke(MemberBox.java:138) org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:292) org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2577) org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42) org.mozilla.javascript.gen.null_null_10905._c_script_0(null.null:3) org.mozilla.javascript.gen.null_null_10905.call(null.null) org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:560) org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3439) org.mozilla.javascript.gen.null_null_10905.call(null.null) org.mozilla.javascript.gen.null_null_10905.exec(null.null) com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:236) com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:107) com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:73) com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:322) com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:283) com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:254) com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:242) com.glide.processors.ScriptProcessor.evaluateScript(ScriptProcessor.java:320) com.glide.processors.ScriptProcessor.runScript(ScriptProcessor.java:215) com.glide.processors.ScriptProcessor.process(ScriptProcessor.java:173) com.glide.processors.AProcessor.runProcessor(AProcessor.java:412) com.glide.processors.AProcessor.processTransaction(AProcessor.java:187) com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:165) com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:49) com.glide.sys.ServletTransaction.run(ServletTransaction.java:34) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) java.lang.Thread.run(Thread.java:745) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i am doing it wrong please suggest.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 00:10:31 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/include-third-party-javascript-library/m-p/1926602#M583528</guid>
      <dc:creator>thisisauniqueus</dc:creator>
      <dc:date>2016-07-07T00:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: Include Third Party Javascript Library</title>
      <link>https://www.servicenow.com/community/developer-forum/include-third-party-javascript-library/m-p/1926603#M583529</link>
      <description>&lt;P&gt;Your sourceTime only has two digits in the year. Your format is calling for 4.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Jul 2016 00:14:21 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/include-third-party-javascript-library/m-p/1926603#M583529</guid>
      <dc:creator>Chuck Tomasi</dc:creator>
      <dc:date>2016-07-07T00:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Include Third Party Javascript Library</title>
      <link>https://www.servicenow.com/community/developer-forum/include-third-party-javascript-library/m-p/1926604#M583530</link>
      <description>&lt;P&gt;Try this.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="padding-left: 30px; font-family: arial, sans-serif; color: #666666;"&gt;&lt;STRONG&gt;var sourceTime = '07-16-2015 16:22:05';&lt;/STRONG&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="padding-left: 30px; font-family: arial, sans-serif; color: #666666;"&gt;var gd = new GlideDateTime(sourceTime);&lt;/P&gt;&lt;BR /&gt;&lt;P style="padding-left: 30px; font-family: arial, sans-serif; color: #666666;"&gt;gd.setValueUTC(sourceTime, "MM-dd-yyyy HH:mm:ss");&lt;/P&gt;&lt;BR /&gt;&lt;P style="padding-left: 30px; font-family: arial, sans-serif; color: #666666;"&gt;var test = gd.getValue();&lt;/P&gt;&lt;BR /&gt;&lt;P style="padding-left: 30px; font-family: arial, sans-serif; color: #666666;"&gt;gs.print(test);&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Jul 2016 00:15:36 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/include-third-party-javascript-library/m-p/1926604#M583530</guid>
      <dc:creator>Chuck Tomasi</dc:creator>
      <dc:date>2016-07-07T00:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: Include Third Party Javascript Library</title>
      <link>https://www.servicenow.com/community/developer-forum/include-third-party-javascript-library/m-p/1926605#M583531</link>
      <description>&lt;P&gt;Hi thanks for your time. It must be a typo, im trying alot of things&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var sourceTime = '07/16/15 16:22:05'; //value i am getting in excel&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var gd = new GlideDateTime(sourceTime);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gd.setValueUTC(sourceTime, "MM-dd-yyyy HH:mm:ss");//this is the target format&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var test = gd.getValue();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gs.print(test);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;i cannot change the source format( using regex will be too messy? as i will be getting alot of excel files?)&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;i was thinking if i can include a 3rd party js lib which can handle multiple formats would be easier. Your thoughts, comments are valuable&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Regards &lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Jul 2016 00:24:18 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/include-third-party-javascript-library/m-p/1926605#M583531</guid>
      <dc:creator>thisisauniqueus</dc:creator>
      <dc:date>2016-07-07T00:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: Include Third Party Javascript Library</title>
      <link>https://www.servicenow.com/community/developer-forum/include-third-party-javascript-library/m-p/1926606#M583532</link>
      <description>&lt;P&gt;please notice the /&lt;STRONG&gt; &lt;/STRONG&gt;in source datetime instead of &lt;STRONG&gt;-&lt;/STRONG&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Jul 2016 00:26:58 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/include-third-party-javascript-library/m-p/1926606#M583532</guid>
      <dc:creator>thisisauniqueus</dc:creator>
      <dc:date>2016-07-07T00:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: Include Third Party Javascript Library</title>
      <link>https://www.servicenow.com/community/developer-forum/include-third-party-javascript-library/m-p/1926607#M583533</link>
      <description>&lt;P&gt;The time needs to be in a format that ServiceNow can digest. yyyy-MM-dd HH:mm:ss works best.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;What I would recommend is a few more lines of code to parse the input format and re-arrange it in to the format that works for the setValueUTC. For example (untested code disclaimer here):&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var sourceArr = sourceTime.split(' ');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var sourceDateArr = sourceArr[0].split('/');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;var newSourceTime = '20' + sourceDateArr[2] + '-' + sourceDateArr[0] + '-' + sourceDateArr[1] + ' ' + sourceArr[1];&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;gs.print('New Time=' + newSourceTime);&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #666666; font-family: arial, sans-serif; line-height: 1.5;"&gt;var gd = new GlideDateTime(sourceTime);&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #666666; font-family: arial, sans-serif; line-height: 1.5;"&gt;// Print the new variable with UTC and timezone applied&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #666666; font-family: arial, sans-serif; line-height: 1.5;"&gt;gs.print('gd.getValue()=' + gd.getValue() + ' gd.getDisplayValue()=' + gd.getDisplayValue());&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Jul 2016 00:32:39 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/include-third-party-javascript-library/m-p/1926607#M583533</guid>
      <dc:creator>Chuck Tomasi</dc:creator>
      <dc:date>2016-07-07T00:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Include Third Party Javascript Library</title>
      <link>https://www.servicenow.com/community/developer-forum/include-third-party-javascript-library/m-p/1926608#M583534</link>
      <description>&lt;P&gt;Thanks alot Chuck. Ill follow your advice &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_emote jive_macro" data-renderedposition="8_265_16_16" src="https://www.servicenow.com/8.0.1.35b65d4/images/emoticons/happy.png"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Jul 2016 05:34:20 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/include-third-party-javascript-library/m-p/1926608#M583534</guid>
      <dc:creator>thisisauniqueus</dc:creator>
      <dc:date>2016-07-07T05:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: Include Third Party Javascript Library</title>
      <link>https://www.servicenow.com/community/developer-forum/include-third-party-javascript-library/m-p/1926609#M583535</link>
      <description>&lt;P&gt;Thank you John. Keep me informed and let me know if it worked.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Jul 2016 08:42:12 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/include-third-party-javascript-library/m-p/1926609#M583535</guid>
      <dc:creator>Chuck Tomasi</dc:creator>
      <dc:date>2016-07-07T08:42:12Z</dc:date>
    </item>
  </channel>
</rss>

