<?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: Simple JavaScript??? in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/simple-javascript/m-p/215724#M168854</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks so much, Zaizi, for the response!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have inserted the following code into my .js file (residing in the Data Dictionary\Scripts directory:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;var heartbeatfile = companyhome.childByNamePath("MySpace/Heartbeat/heartbeat.txt");&lt;BR /&gt;var d = new Date();&lt;BR /&gt;&lt;BR /&gt;// update the modified property&lt;BR /&gt;heartbeatfile.properties["cm:modified"] = d;&lt;BR /&gt;&lt;BR /&gt;// update the file content&lt;BR /&gt;heartbeatfile.content = d.toString();&lt;BR /&gt;&lt;BR /&gt;heartbeatfile.save();&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Where "MySpace" is a space defined under Company Home, and "Heartbeat" is a subspace under MySpace.&amp;nbsp; "heartbeat.txt" is the file I would like to update.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I put that code in, I got the following error, at execution time:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;Failed to approve the document due to system error: Failed to execute script 'workspace://SpacesStore/92a0850e-0476-468a-99f6-e028401de4eb': TypeError: Cannot read property "properties" from null (workspace://SpacesStore/92a0850e-0476-468a-99f6-e028401de4eb#5)&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas what might be the cause?&amp;nbsp; I was seeing similar error in previous trial-and-error scripting.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;BTW - I like your idea of the WebScript, responding with a datetime of the most recently updated content in the "Live" folder.&amp;nbsp; I may create an implementation of that, once I get this script working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Todd&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Feb 2010 15:16:28 GMT</pubDate>
    <dc:creator>peterstb</dc:creator>
    <dc:date>2010-02-24T15:16:28Z</dc:date>
    <item>
      <title>Simple JavaScript???</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/simple-javascript/m-p/215722#M168852</link>
      <description>Hi,I'm struggling with something that feels like it should be as simple javascripting exercise, and am not able to derive any help from the JavaScript API reference or the JavaScript API Cookbook.&amp;nbsp; Although both are good documents, I seem to be struggling with context, specifically related to gettin</description>
      <pubDate>Tue, 23 Feb 2010 22:21:44 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/simple-javascript/m-p/215722#M168852</guid>
      <dc:creator>peterstb</dc:creator>
      <dc:date>2010-02-23T22:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: Simple JavaScript???</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/simple-javascript/m-p/215723#M168853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;var heartbeatfile = companyhome.childByNamePath("path to heart beat file");&lt;BR /&gt;var d = new Date();&lt;BR /&gt;// update the modified property&lt;BR /&gt;heartbeatfile.properties["cm:modified"] = d;&lt;BR /&gt;// update the file content&lt;BR /&gt;heartbeatfile.content = d.toString();&lt;BR /&gt;heartbeatfile.save();&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;Alternatively, you can just write a webscript (&lt;/SPAN&gt;&lt;A href="http://wiki.alfresco.com/wiki/Web_Scripts" rel="nofollow noopener noreferrer"&gt;http://wiki.alfresco.com/wiki/Web_Scripts&lt;/A&gt;&lt;SPAN&gt;) that does a search through your live space and returns the date / time of the most recently updated document.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Feb 2010 08:16:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/simple-javascript/m-p/215723#M168853</guid>
      <dc:creator>zaizi</dc:creator>
      <dc:date>2010-02-24T08:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: Simple JavaScript???</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/simple-javascript/m-p/215724#M168854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks so much, Zaizi, for the response!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have inserted the following code into my .js file (residing in the Data Dictionary\Scripts directory:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;var heartbeatfile = companyhome.childByNamePath("MySpace/Heartbeat/heartbeat.txt");&lt;BR /&gt;var d = new Date();&lt;BR /&gt;&lt;BR /&gt;// update the modified property&lt;BR /&gt;heartbeatfile.properties["cm:modified"] = d;&lt;BR /&gt;&lt;BR /&gt;// update the file content&lt;BR /&gt;heartbeatfile.content = d.toString();&lt;BR /&gt;&lt;BR /&gt;heartbeatfile.save();&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Where "MySpace" is a space defined under Company Home, and "Heartbeat" is a subspace under MySpace.&amp;nbsp; "heartbeat.txt" is the file I would like to update.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I put that code in, I got the following error, at execution time:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;Failed to approve the document due to system error: Failed to execute script 'workspace://SpacesStore/92a0850e-0476-468a-99f6-e028401de4eb': TypeError: Cannot read property "properties" from null (workspace://SpacesStore/92a0850e-0476-468a-99f6-e028401de4eb#5)&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas what might be the cause?&amp;nbsp; I was seeing similar error in previous trial-and-error scripting.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;BTW - I like your idea of the WebScript, responding with a datetime of the most recently updated content in the "Live" folder.&amp;nbsp; I may create an implementation of that, once I get this script working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Todd&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Feb 2010 15:16:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/simple-javascript/m-p/215724#M168854</guid>
      <dc:creator>peterstb</dc:creator>
      <dc:date>2010-02-24T15:16:28Z</dc:date>
    </item>
  </channel>
</rss>

