<?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: JavaScript API &amp; NodeRef troubles in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/javascript-api-noderef-troubles/m-p/56793#M34394</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is it &lt;/SPAN&gt;&lt;EM&gt;possible&lt;/EM&gt;&lt;SPAN&gt; to get the categories with the 1.3 javascript engine - but tricky. Basically the NodeRef values you have can be used to perform a lucene query to get each node by hand. So for each NodeRef value retrieved from the categories property, you need to build a Lucene query along the lines of:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;ID:noderef&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;SPAN&gt;Note that the NodeRef.toString() can be used, but you will need to escape the ':' and '/' characters to '\:' and '\/' (yes annoying but needed for the lucene query parsing).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So you query will look something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;ID:workspace\:\/\/SpacesStore\/e4f30acf-e98b-11da-821a-936824f635fe&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;SPAN&gt;You can then execute the lucene query using the 'search.luceneSearch()' javascript call. The results from each query will be an Array of size 1 (assuming it finds the category - it should!) which will contain a correctly populated script Node object (i.e. you can execute .name and .properties or similar on it). So you query for each category in turn and that will give you what you need for now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kevin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 Aug 2006 09:17:34 GMT</pubDate>
    <dc:creator>kevinr</dc:creator>
    <dc:date>2006-08-31T09:17:34Z</dc:date>
    <item>
      <title>JavaScript API &amp; NodeRef troubles</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/javascript-api-noderef-troubles/m-p/56790#M34391</link>
      <description>Hi Alfresco,I'm trying to retrieve the categories attached to a document with JavaScript API in Alfresco Enterprise 1.3.1. I tried the example from the JavaScript WIKI with the "var locale = document.properties.locale.properties.name;" command. I added the locale aspect to the document but get this</description>
      <pubDate>Wed, 30 Aug 2006 15:29:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/javascript-api-noderef-troubles/m-p/56790#M34391</guid>
      <dc:creator>simon</dc:creator>
      <dc:date>2006-08-30T15:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: JavaScript API &amp; NodeRef troubles</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/javascript-api-noderef-troubles/m-p/56791#M34392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I'm trying to retrieve the categories attached to a document with JavaScript API in Alfresco Enterprise 1.3.1. I tried the example from the &lt;A href="http://wiki.alfresco.com/wiki/JavaScript_API" rel="nofollow noopener noreferrer"&gt;JavaScript WIKI&lt;/A&gt; with the "var locale = document.properties.locale.properties.name;" command. I added the locale aspect to the document but get this error: &lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;* Failed to run Actions due to error: Failed to execute script 'workspace://SpacesStore/df918dab-380d-11db-9652-a5e698739f92': TypeError: Cannot read property "properties" from null (AlfrescoScript#25)&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;/CODE&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Locale and categories are two different things. You cannot get a value from the locale property until you have set it to something, so 'null' is correct.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Tried the same for the categories but it returns a NodeRef for every category and I can't add the ".properties.name" after a NodeRef element, it returns the null object.&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;One special feature is all properties of type NodeRef are automatically converted into another Node object.&lt;/BLOCKQUOTE&gt;What does this mean? I think it's what I tried with both the locale and the categories but I can't get it to work. Any ideas?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;There was a bug in the JavaScript engine where we did not correctly convert multi-value properties (such as categories!) to objects as expected by the script, this is fixed in HEAD/1.4.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kevin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Aug 2006 16:43:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/javascript-api-noderef-troubles/m-p/56791#M34392</guid>
      <dc:creator>kevinr</dc:creator>
      <dc:date>2006-08-30T16:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: JavaScript API &amp; NodeRef troubles</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/javascript-api-noderef-troubles/m-p/56792#M34393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I know categories and locale are two different things, I only used the locale to test with but I tried again and indeed, this works. Thanks Kevin.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Problem is I need the categories in the JavaScript API. When is the 1.4 Enterprise release planned?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 08:15:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/javascript-api-noderef-troubles/m-p/56792#M34393</guid>
      <dc:creator>simon</dc:creator>
      <dc:date>2006-08-31T08:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: JavaScript API &amp; NodeRef troubles</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/javascript-api-noderef-troubles/m-p/56793#M34394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is it &lt;/SPAN&gt;&lt;EM&gt;possible&lt;/EM&gt;&lt;SPAN&gt; to get the categories with the 1.3 javascript engine - but tricky. Basically the NodeRef values you have can be used to perform a lucene query to get each node by hand. So for each NodeRef value retrieved from the categories property, you need to build a Lucene query along the lines of:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;ID:noderef&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;SPAN&gt;Note that the NodeRef.toString() can be used, but you will need to escape the ':' and '/' characters to '\:' and '\/' (yes annoying but needed for the lucene query parsing).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So you query will look something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;ID:workspace\:\/\/SpacesStore\/e4f30acf-e98b-11da-821a-936824f635fe&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;SPAN&gt;You can then execute the lucene query using the 'search.luceneSearch()' javascript call. The results from each query will be an Array of size 1 (assuming it finds the category - it should!) which will contain a correctly populated script Node object (i.e. you can execute .name and .properties or similar on it). So you query for each category in turn and that will give you what you need for now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kevin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Aug 2006 09:17:34 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/javascript-api-noderef-troubles/m-p/56793#M34394</guid>
      <dc:creator>kevinr</dc:creator>
      <dc:date>2006-08-31T09:17:34Z</dc:date>
    </item>
  </channel>
</rss>

