<?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: setting article properties from webscript in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/setting-article-properties-from-webscript/m-p/262640#M215770</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Never mind, I figured it out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the suggestions&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 08 Jul 2012 10:21:39 GMT</pubDate>
    <dc:creator>schipmolder</dc:creator>
    <dc:date>2012-07-08T10:21:39Z</dc:date>
    <item>
      <title>setting article properties from webscript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-article-properties-from-webscript/m-p/262637#M215767</link>
      <description>Hi, I'm using a pretty much default deployment of 4.0.d with a web quick start site and I was wondering how i can get and set the value of a property using a javascript web script.I've added a new property to the ws:article type of ws:readCount (d:int) and I'd like it to increment by one every time</description>
      <pubDate>Wed, 04 Jul 2012 23:53:33 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-article-properties-from-webscript/m-p/262637#M215767</guid>
      <dc:creator>schipmolder</dc:creator>
      <dc:date>2012-07-04T23:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: setting article properties from webscript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-article-properties-from-webscript/m-p/262638#M215768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It appears that you have added your own custom property to Alfresco's out-of-the-box content model. You should not do that. Instead, extend the model with your own and add your own types, properties, aspects, etc., to your own namespace.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With that said, this code should do the trick:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;var someDoc = search.findNode(args.nodeRef);&lt;BR /&gt;var counter = someDoc.properties['ws:readCount'];&lt;BR /&gt;counter += 1;&lt;BR /&gt;someDoc.properties['ws:readCount'] = counter;&lt;BR /&gt;someDoc.save();&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;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;More info:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://docs.alfresco.com/4.0/topic/com.alfresco.enterprise.doc/references/API-JS-Scripting-API.html" rel="nofollow noopener noreferrer"&gt;JavaScript scripting API&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://wiki.alfresco.com/wiki/JavaScript_API_Cookbook" rel="nofollow noopener noreferrer"&gt;JavaScript Cookbook&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://ecmarchitect.com/images/articles/alfresco-webscripts/web-script-article.pdf" rel="nofollow noopener noreferrer"&gt;Intro to the Web Script Framework Tutorial&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jul 2012 13:31:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-article-properties-from-webscript/m-p/262638#M215768</guid>
      <dc:creator>jpotts</dc:creator>
      <dc:date>2012-07-05T13:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: setting article properties from webscript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-article-properties-from-webscript/m-p/262639#M215769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Jeff,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I understand your point about extending the model, but if the behaviours of the wqs module automatically changes the type of a new article to ws:article wouldn't that mean my custom properties would not be applied to those articles?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Or are you saying that I should extend the model, edit the source of the wqs module so it works with my custom:article objects and then re-build it myself?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regarding the javascript webscript, I had something very similar before but the script doesn't seem to have a 'search' object so it throws a 'ReferenceError: "search" is not defined' exception.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Where would i be able to inject the searchservice into the bean (assuming it works the same as with a java backed webscript)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Skip&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jul 2012 14:31:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-article-properties-from-webscript/m-p/262639#M215769</guid>
      <dc:creator>schipmolder</dc:creator>
      <dc:date>2012-07-05T14:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: setting article properties from webscript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-article-properties-from-webscript/m-p/262640#M215770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Never mind, I figured it out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the suggestions&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Jul 2012 10:21:39 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-article-properties-from-webscript/m-p/262640#M215770</guid>
      <dc:creator>schipmolder</dc:creator>
      <dc:date>2012-07-08T10:21:39Z</dc:date>
    </item>
  </channel>
</rss>

