<?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 How to move duplicate document to a folder in alfresco community edition 5.2? in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/how-to-move-duplicate-document-to-a-folder-in-alfresco-community/m-p/37162#M15630</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Scenario:&lt;/P&gt;&lt;P&gt;I have to move Hellp.txt from Draft folder to Approved folder. First time it is working properly and sitting in the Approved folder but second time if i am trying move the updated same document second time then it is giving the following exception&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;org.alfresco.service.cmr.repository.DuplicateChildNodeNameException.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;in this scenario, document name is same so it is giving this exception so we have to identify whether the approved folder has this document. if yes then delete that document and move the updated document else directly move the document to Approved folder.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if any web script available, please share with me.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thanks in advance.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Regards,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Muqthar&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 04 Mar 2017 17:07:42 GMT</pubDate>
    <dc:creator>muqthar</dc:creator>
    <dc:date>2017-03-04T17:07:42Z</dc:date>
    <item>
      <title>How to move duplicate document to a folder in alfresco community edition 5.2?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-move-duplicate-document-to-a-folder-in-alfresco-community/m-p/37162#M15630</link>
      <description>Scenario:I have to move Hellp.txt from Draft folder to Approved folder. First time it is working properly and sitting in the Approved folder but second time if i am trying move the updated same document second time then it is giving the following exceptionorg.alfresco.service.cmr.repository.Duplicat</description>
      <pubDate>Sat, 04 Mar 2017 17:07:42 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-move-duplicate-document-to-a-folder-in-alfresco-community/m-p/37162#M15630</guid>
      <dc:creator>muqthar</dc:creator>
      <dc:date>2017-03-04T17:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to move duplicate document to a folder in alfresco community edition 5.2?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-move-duplicate-document-to-a-folder-in-alfresco-community/m-p/37163#M15631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is easily scripted. You should look at the &lt;A href="http://docs.alfresco.com/community/references/API-JS-Scripting-API.html" rel="nofollow noopener noreferrer"&gt;Alfresco JavaScript API&lt;/A&gt;. In particular, you will probably want to look at the &lt;A href="http://docs.alfresco.com/community/references/API-JS-childbyNamePath.html" rel="nofollow noopener noreferrer"&gt;getChildByNamePath&lt;/A&gt; function on ScriptNode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try that out and let us know if you get stuck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Mar 2017 21:35:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-move-duplicate-document-to-a-folder-in-alfresco-community/m-p/37163#M15631</guid>
      <dc:creator>jpotts</dc:creator>
      <dc:date>2017-03-05T21:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to move duplicate document to a folder in alfresco community edition 5.2?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-move-duplicate-document-to-a-folder-in-alfresco-community/m-p/37164#M15632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Jeff,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your swift response.&lt;/P&gt;&lt;P&gt;We have written javascript and added as a rule (execute script) but the main problem is,&lt;/P&gt;&lt;P&gt;Move function is executing before our script so getting the same exception.&lt;/P&gt;&lt;P&gt;It will be helpful, if you provide any other alternate approach to achieve this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Mar 2017 09:22:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-move-duplicate-document-to-a-folder-in-alfresco-community/m-p/37164#M15632</guid>
      <dc:creator>muqthar</dc:creator>
      <dc:date>2017-03-06T09:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to move duplicate document to a folder in alfresco community edition 5.2?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-move-duplicate-document-to-a-folder-in-alfresco-community/m-p/37165#M15633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One more thought,&lt;/P&gt;&lt;P&gt;Can we use any existing aspects to achieve this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Mar 2017 09:28:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-move-duplicate-document-to-a-folder-in-alfresco-community/m-p/37165#M15633</guid>
      <dc:creator>muqthar</dc:creator>
      <dc:date>2017-03-06T09:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to move duplicate document to a folder in alfresco community edition 5.2?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-move-duplicate-document-to-a-folder-in-alfresco-community/m-p/37166#M15634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can anybody help me with this issue. Not able to move the document second time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Mar 2017 14:08:39 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-move-duplicate-document-to-a-folder-in-alfresco-community/m-p/37166#M15634</guid>
      <dc:creator>muqthar</dc:creator>
      <dc:date>2017-03-07T14:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to move duplicate document to a folder in alfresco community edition 5.2?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-move-duplicate-document-to-a-folder-in-alfresco-community/m-p/37167#M15635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you talking about the Move action in the UI?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If that is the case, you can simply replace that by the move function using the javascript API.&lt;/P&gt;&lt;P&gt;Change the order with the existence check, and if everything is ok, then execute the move by code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (document.properties["esc:semana"] &amp;amp;&amp;amp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; document.properties["esc:ano"]) {&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var ano = document.properties["esc:ano"];&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var semana = document.properties["esc:semana"];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var site = siteService.getSite(document.siteShortName);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var doclib = site.getContainer("documentLibrary");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var pastaAno = doclib.childByNamePath(ano);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!pastaAno) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pastaAno = doclib.createFolder(ano);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var pastaSemana = pastaAno.childByNamePath(semana);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!pastaSemana) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pastaSemana = pastaAno.createFolder(semana);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; document.move(pastaSemana);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notice that I am using both &lt;STRONG&gt;childByNamePath&lt;/STRONG&gt; and &lt;STRONG&gt;move&lt;/STRONG&gt; functions in the piece of code.&lt;/P&gt;&lt;P&gt;I hope you find this useful for your case.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Mar 2017 19:12:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-move-duplicate-document-to-a-folder-in-alfresco-community/m-p/37167#M15635</guid>
      <dc:creator>douglascrp</dc:creator>
      <dc:date>2017-03-07T19:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to move duplicate document to a folder in alfresco community edition 5.2?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-move-duplicate-document-to-a-folder-in-alfresco-community/m-p/37168#M15636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What do you mean by existing aspects?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Mar 2017 19:08:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-move-duplicate-document-to-a-folder-in-alfresco-community/m-p/37168#M15636</guid>
      <dc:creator>douglascrp</dc:creator>
      <dc:date>2017-03-08T19:08:10Z</dc:date>
    </item>
  </channel>
</rss>

