<?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: Set Tag on folder name (custom folder model) in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/set-tag-on-folder-name-custom-folder-model/m-p/104599#M29656</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can create rule on root folder.That rule is excute script where tag add code is wrriten in js file.&lt;/P&gt;&lt;P&gt;Excute that rule with applied to subfolder.&lt;/P&gt;&lt;P&gt;Code :&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;if(document.isContainer){
    document.addTag(document.name);
    document.save();
}else{
    document.addTag(document.parent.name);
    document.save();
}&lt;/PRE&gt;</description>
    <pubDate>Tue, 07 Apr 2020 11:34:37 GMT</pubDate>
    <dc:creator>sp2</dc:creator>
    <dc:date>2020-04-07T11:34:37Z</dc:date>
    <item>
      <title>Set Tag on folder name (custom folder model)</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/set-tag-on-folder-name-custom-folder-model/m-p/104598#M29655</link>
      <description>&lt;P&gt;Hi, i'm on Communty 6.2&amp;nbsp; for my office installation and i have set-up a main folder "Customers" in which there are N folders, one for each of these. I'm trying to make something like a "customer file" orgarnizzation.&lt;/P&gt;&lt;P&gt;Each customer folder is auto-changed to a custom model (Customer File) for refine the rules applied.&lt;/P&gt;&lt;P&gt;Currently i want to automatically add a tag on these special folders exactly the same as the folder name, and auto apply these tag to any document created/uploaded in the customer folder.&lt;/P&gt;&lt;P&gt;Customer (main folder)&lt;BR /&gt;|&lt;BR /&gt;|_customer A folder (custom model) with tag "customer a"&lt;BR /&gt;&amp;nbsp; &amp;nbsp;|_file.docx (with tag "customer a")&lt;BR /&gt;&amp;nbsp; &amp;nbsp;|_file.jpg (with tag "customer a")&lt;BR /&gt;&amp;nbsp; &amp;nbsp;|_.......&lt;/P&gt;&lt;P&gt;Someone can help me in this script? I'm totally new to alfresco... thanks since now!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2020 10:05:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/set-tag-on-folder-name-custom-folder-model/m-p/104598#M29655</guid>
      <dc:creator>TheCondor</dc:creator>
      <dc:date>2020-03-26T10:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: Set Tag on folder name (custom folder model)</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/set-tag-on-folder-name-custom-folder-model/m-p/104599#M29656</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can create rule on root folder.That rule is excute script where tag add code is wrriten in js file.&lt;/P&gt;&lt;P&gt;Excute that rule with applied to subfolder.&lt;/P&gt;&lt;P&gt;Code :&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;if(document.isContainer){
    document.addTag(document.name);
    document.save();
}else{
    document.addTag(document.parent.name);
    document.save();
}&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Apr 2020 11:34:37 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/set-tag-on-folder-name-custom-folder-model/m-p/104599#M29656</guid>
      <dc:creator>sp2</dc:creator>
      <dc:date>2020-04-07T11:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: Set Tag on folder name (custom folder model)</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/set-tag-on-folder-name-custom-folder-model/m-p/104600#M29657</link>
      <description>&lt;P&gt;Thank you so much Sanjay for your help!&lt;/P&gt;&lt;P&gt;Using your script and another which i found here&lt;BR /&gt;&lt;A href="https://hub.alfresco.com/t5/alfresco-content-services-forum/when-using-an-execute-script-rule-how-can-i-determine-the-name/td-p/186590" target="_blank" rel="nofollow noopener noreferrer"&gt;https://hub.alfresco.com/t5/alfresco-content-services-forum/when-using-an-execute-script-rule-how-can-i-determine-the-name/td-p/186590&lt;/A&gt;&lt;/P&gt;&lt;P&gt;i was to build two rules, one (your script) which auto generate a tag from the customer folder name (i applyed the rule just for the rist level, ignoring sub folder inside each customer.&lt;/P&gt;&lt;P&gt;After i applyed another rules, on each file which is NOT a folder (so i exclude to tag subfolder) with this script where it apply the tag based on the 5th folder name in the path (which is actually the customer name!):&lt;/P&gt;&lt;PRE&gt;var vCurrentFolder = " "
var vElementCount = 0
var pathArray = document.displayPath.split( '/' );
vElementCount = pathArray.length;
vElementCount = 6;
vCurrentFolder = pathArray[vElementCount];

if(document.isContainer){
    document.addTag(vCurrentFolder);
    document.save();
}else{
    document.addTag(vCurrentFolder);
    document.save();
}&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Apr 2020 13:26:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/set-tag-on-folder-name-custom-folder-model/m-p/104600#M29657</guid>
      <dc:creator>TheCondor</dc:creator>
      <dc:date>2020-04-07T13:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Set Tag on folder name (custom folder model)</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/set-tag-on-folder-name-custom-folder-model/m-p/104601#M29658</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/80804"&gt;@TheCondor&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;So glad you've been able to resolve your issue with the help of&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/36939"&gt;@sanjaybandhniya&lt;/A&gt;. Thanks also for reporting how you did it - really helpful to other users.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 15:10:29 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/set-tag-on-folder-name-custom-folder-model/m-p/104601#M29658</guid>
      <dc:creator>EddieMay</dc:creator>
      <dc:date>2020-04-08T15:10:29Z</dc:date>
    </item>
  </channel>
</rss>

