<?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 Fail to move file on custom activiti workflow (runAs admin) in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/fail-to-move-file-on-custom-activiti-workflow-runas-admin/m-p/278166#M231296</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 thought this topic was common asked here but I couldn't found the solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created a custom activiti&amp;nbsp; workflow (AMP module) which will move document when approved.&lt;/P&gt;&lt;P&gt;The part of user task code as shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14767918969837163" data-hasrefreshed="true" data-renderedposition="158_8_1239_752" jivemacro_uid="_14767918969837163" modifiedtitle="true"&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;lt;userTask id="approved" name="Ack. Document Approved" activiti:assignee="${initiator.properties.userName}" activiti:formKey="wf:approvedTask"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;documentation&amp;gt;The document was reviewed and approved.&amp;lt;/documentation&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;extensionElements&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;activiti:field name="runAs"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;activiti:string&amp;gt;&amp;lt;![CDATA[admin]]&amp;gt;&amp;lt;/activiti:string&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/activiti:field&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;activiti:field name="script"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;activiti:string&amp;gt;&amp;lt;![CDATA[var d = new Date(),&lt;/P&gt;&lt;P&gt;&amp;nbsp; month = '' + (d.getMonth() + 1),&lt;/P&gt;&lt;P&gt;&amp;nbsp; day = '' + d.getDate(),&lt;/P&gt;&lt;P&gt;&amp;nbsp; year = d.getFullYear();&lt;/P&gt;&lt;P&gt;var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];&lt;/P&gt;&lt;P&gt;var month = monthNames[d.getMonth()];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (day.length &amp;lt; 2) day = '0' + day;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// to display&lt;/P&gt;&lt;P&gt;var ddmonyyyy = [day, month, year].join('-');&lt;/P&gt;&lt;P&gt;var hhmmss = d.toLocaleTimeString();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for (var i = 0; i &amp;lt; bpm_package.children.length; i++)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; var doc = bpm_package.children[i];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Set apporval information aspect&lt;/P&gt;&lt;P&gt;&amp;nbsp; doc.properties["sam:doc-approval-status"] = 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; doc.properties["sam:doc-approval-info"] = "Set via workflow: Approved by " + person.properties.userName + " on " + ddmonyyyy&amp;nbsp; + " " + hhmmss;&lt;/P&gt;&lt;P&gt;&amp;nbsp; doc.save();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Move document to PUJ root directory&lt;/P&gt;&lt;P&gt;&amp;nbsp; var dest = companyhome.childByNamePath("Sites/legal-department/documentLibrary/PUJ");&lt;/P&gt;&lt;P&gt;&amp;nbsp; var res = doc.move(dest);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; logger.log("Doc: " + doc.name + " move to: " + dest + " RES: " + res);&lt;/P&gt;&lt;P&gt;}]]&amp;gt;&amp;lt;/activiti:string&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/activiti:field&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/activiti:taskListener&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/extensionElements&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/userTask&amp;gt;&lt;/P&gt;&lt;P&gt;The file is fail to upload&lt;/P&gt;&lt;P&gt;The log4j log4j.logger.org.alfresco.repo.jscript.ScriptLogger=debug&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;File is still fail to move.&lt;/P&gt;&lt;P&gt;Log file also has no information even I put the log and log4j set to debug (log4j.logger.org.alfresco.repo.jscript.ScriptLogger=debug).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know what I might missing to?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;[bayu]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Oct 2016 12:02:21 GMT</pubDate>
    <dc:creator>billydekid</dc:creator>
    <dc:date>2016-10-18T12:02:21Z</dc:date>
    <item>
      <title>Fail to move file on custom activiti workflow (runAs admin)</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/fail-to-move-file-on-custom-activiti-workflow-runas-admin/m-p/278166#M231296</link>
      <description>Hi,I thought this topic was common asked here but I couldn't found the solution.I created a custom activiti&amp;nbsp; workflow (AMP module) which will move document when approved.The part of user task code as shown below:&amp;nbsp;&amp;nbsp; &amp;lt;userTask id="approved" name="Ack. Document Approved" activiti:assignee="${initiat</description>
      <pubDate>Tue, 18 Oct 2016 12:02:21 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/fail-to-move-file-on-custom-activiti-workflow-runas-admin/m-p/278166#M231296</guid>
      <dc:creator>billydekid</dc:creator>
      <dc:date>2016-10-18T12:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Fail to move file on custom activiti workflow (runAs admin)</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/fail-to-move-file-on-custom-activiti-workflow-runas-admin/m-p/278167#M231297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Problem solved.&lt;/P&gt;&lt;P&gt;It seems the problem on how the alfresco load the activiti bpmn files loaded into alfresco apps (I don't know what exactly the correct terms).&lt;/P&gt;&lt;P&gt;Since I checked after deployed the latest AMP (with previous deleted tomcat work and temp dirs &amp;amp; delete alfresco dir inside webapps), this step didn't affect to workflow. Even the bpmn file is the latest deployed into the module dir, the workflow still refer to the old one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Until I reinstall the fresh new alfresco, install the module (amp) and run the workflow then it works.&lt;/P&gt;&lt;P&gt;I use ALF 5.1.f on Ubuntu 14.04.5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;[bayu]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 00:48:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/fail-to-move-file-on-custom-activiti-workflow-runas-admin/m-p/278167#M231297</guid>
      <dc:creator>billydekid</dc:creator>
      <dc:date>2016-10-19T00:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: Fail to move file on custom activiti workflow (runAs admin)</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/fail-to-move-file-on-custom-activiti-workflow-runas-admin/m-p/278168#M231298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;UPDATE:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;The above solution was not the best solutions since we should reinstall the alfresco.&lt;/P&gt;&lt;P&gt;After some research on Tomcat cache and found no solutions on cache, I then move to Module console.&lt;/P&gt;&lt;P&gt;By execute "show definitions all" I found that my workflow is listed two versions (version 1 and version 2), FYI. I updated from version 1.0 to 1.1 and from this console we saw that Alfresco save two workflows inside.&lt;/P&gt;&lt;P&gt;My problem was that workflow is always use workflow version 1.0 (which known in console is version 1) not 1.1 (know as version 2).&lt;/P&gt;&lt;P&gt;Then I undeploy workflow version 1 by command &lt;STRONG&gt;undeploy definition &amp;lt;workflow id&amp;gt;&lt;/STRONG&gt; and my workflow run as expected using the latest version 1.1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this information helps.&lt;/P&gt;&lt;P&gt;I still wonder, even MMT reported that my workflow updated successfully form 1.0 to 1.1, why alfresco still keep the 1.0 version not overwrite it.&lt;/P&gt;&lt;P&gt;Maybe someone can answer this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2016 03:52:21 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/fail-to-move-file-on-custom-activiti-workflow-runas-admin/m-p/278168#M231298</guid>
      <dc:creator>billydekid</dc:creator>
      <dc:date>2016-10-20T03:52:21Z</dc:date>
    </item>
  </channel>
</rss>

