<?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 ScriptAction.execute() produces error in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/scriptaction-execute-produces-error/m-p/31220#M13236</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I am trying to perform a transformation.&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; action &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; actions&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;create&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"transform"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;action&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;parameters&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"destination-folder"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; folder&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;action&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;parameters&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"assoc-type"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;&lt;SPAN&gt;"{&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.alfresco.org/model/content/1.0" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.alfresco.org/model/content/1.0&lt;/A&gt;&lt;SPAN&gt;}contains"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;action&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;parameters&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"assoc-name"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; document&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;toString&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"transformed"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;action&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;parameters&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"mime-type"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"text/html"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;action&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;parameters&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"overwrite-copy"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;false&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;action&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;execute&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;document&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getNodeRef&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This produces the following error on line 7:&lt;/P&gt;&lt;P&gt;org.mozilla.javascript.ConsString cannot be cast to org.alfresco.service.namespace.QName&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have read that one should change all JavaScript Strings with the .toString() method in order to resolve the issue and I tried this in the above example, but it still gives me the same error. Have I forgotten anything?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Jul 2017 09:27:10 GMT</pubDate>
    <dc:creator>qwertz</dc:creator>
    <dc:date>2017-07-03T09:27:10Z</dc:date>
    <item>
      <title>ScriptAction.execute() produces error</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/scriptaction-execute-produces-error/m-p/31220#M13236</link>
      <description>Hi!I am trying to perform a transformation.var action = actions.create("transform");action.parameters["destination-folder"] = folder;action.parameters["assoc-type"] = "{http://www.alfresco.org/model/content/1.0}contains";action.parameters["assoc-name"] = document.name.toString() + "transformed";acti</description>
      <pubDate>Mon, 03 Jul 2017 09:27:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/scriptaction-execute-produces-error/m-p/31220#M13236</guid>
      <dc:creator>qwertz</dc:creator>
      <dc:date>2017-07-03T09:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: ScriptAction.execute() produces error</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/scriptaction-execute-produces-error/m-p/31221#M13237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok I just figured it out, line 4 must be changed to &lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;action.parameters["assoc-name"] = (document.name + "transformed").toString(); &lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Jul 2017 10:15:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/scriptaction-execute-produces-error/m-p/31221#M13237</guid>
      <dc:creator>qwertz</dc:creator>
      <dc:date>2017-07-03T10:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: ScriptAction.execute() produces error</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/scriptaction-execute-produces-error/m-p/31222#M13238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In my optinion this would be worth a bug report in the &lt;A href="https://issues.alfresco.com" rel="nofollow noopener noreferrer"&gt;Alfresco JIRA&lt;/A&gt;. A constructed string (ConsString) is a valid JavaScript string and should be supported by the Alfresco JavaScript API. Chances are that Alfresco will not fix this though, similar to other long standing issues with the script integration, e.g. the fact that you cannot reliably do === comparisons of strings due to the Java vs. JavaScript type incompatibility (though in other areas Java strings will behave just like JavaScript ones).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Jul 2017 13:07:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/scriptaction-execute-produces-error/m-p/31222#M13238</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2017-07-03T13:07:01Z</dc:date>
    </item>
  </channel>
</rss>

