<?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 JavaScript API Error on rule/action in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/javascript-api-error-on-rule-action/m-p/307500#M260630</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm try to write a script for create a new subfolder when email is send to an alfresco folder (associted to an alias) via SMTP.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to create this subfolder under the folder that is performing the rule;therefore, the new folder should be named as the Subject field of the email arrived.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The script is associated to the folder via rule, and i try to execute it in backgroud and not. The rule i applied only to document that have the "emailed" Aspect. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I cannot use the debugger, because an issue of alfresco 4.2d edition. But i had try debugging code omitting some line and the error is in the -document.properties["cm:subjectline"] - function. If i set it with static string the folder is created.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the code/flow:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;/* The mail new mail arrive to folder with alias &lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:rnc@cms.pasello.com" rel="nofollow noopener noreferrer"&gt;rnc@cms.pasello.com&lt;/A&gt;&lt;SPAN&gt; */&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var id = companyhome.id;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var name = companyhome.name;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var type = companyhome.type;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var noderef = companyhome.nodeRef;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var childList = companyhome.children;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var properties = companyhome.properties;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var assocs = companyhome.assocs;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/*I change doccument mimetype for correct&amp;nbsp; preview and save it */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;document.mimetype="text/html";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;document.save();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/*Add a new folder naming it with the same name as email subject */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var newRNCFolder = space.childByNamePath(document.properties["cm:subjectline"]);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if (newRNCFolder == null &amp;amp;&amp;amp; space.hasPermission("CreateChildren"))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; // create the folder for the first time&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; newRNCFolder = space.createFolder(document.properties["cm:subjectline"]);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;space.save();&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 May 2013 19:49:13 GMT</pubDate>
    <dc:creator>marcello_modica</dc:creator>
    <dc:date>2013-05-10T19:49:13Z</dc:date>
    <item>
      <title>JavaScript API Error on rule/action</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/javascript-api-error-on-rule-action/m-p/307500#M260630</link>
      <description>I'm try to write a script for create a new subfolder when email is send to an alfresco folder (associted to an alias) via SMTP.I need to create this subfolder under the folder that is performing the rule;therefore, the new folder should be named as the Subject field of the email arrived.The script i</description>
      <pubDate>Fri, 10 May 2013 19:49:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/javascript-api-error-on-rule-action/m-p/307500#M260630</guid>
      <dc:creator>marcello_modica</dc:creator>
      <dc:date>2013-05-10T19:49:13Z</dc:date>
    </item>
    <item>
      <title>Re: JavaScript API Error on rule/action</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/javascript-api-error-on-rule-action/m-p/307501#M260631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the property cm:subjectline may simply not be set which will result in errors when you attempt to create a folder without providing a name (or even an invalid name, as the value of cm:subjectline can be incompatible with the required file / folder name). I'd suggest adding the necessary checks to your script, i.e. verify that cm:subjectline actually has a value and then attempt to lookup / create a folder based on it - additionaly, you must make sure to sanitize cm:subjectline to comply with cm:name constraints about allowed format.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Axel&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 10:44:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/javascript-api-error-on-rule-action/m-p/307501#M260631</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2013-05-14T10:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: JavaScript API Error on rule/action</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/javascript-api-error-on-rule-action/m-p/307502#M260632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;[solved]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I POST MY SOLUTION IN &lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://forums.alfresco.com/node/50460#comment-134147" rel="nofollow noopener noreferrer"&gt;https://forums.alfresco.com/node/50460#comment-134147&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 May 2013 07:23:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/javascript-api-error-on-rule-action/m-p/307502#M260632</guid>
      <dc:creator>marcello_modica</dc:creator>
      <dc:date>2013-05-17T07:23:55Z</dc:date>
    </item>
  </channel>
</rss>

