AnsweredAssumed Answered

Add custom aspect as a rule

Question asked by dave984 on Jun 6, 2013
Latest reply on Mar 28, 2014 by rjohnson
HI, my goal is to add to a folder a rule that automatically add an aspect to all the item in that folder. I'm using Alfresco 4.2.c .
So the point is how to add to the combobox(refer to the this image: http://goo.gl/R630G ) of the available aspect the one i've created.
Here is my code for my custom model:

<namespaces>
   <namespace uri="http://www.mymodel.com/model/content/1.0" prefix="myCustom" />
</namespaces>

   <types>
      <!– Enterprise-wide generic document type –>
      <type name="myCustom:docContentType">
         <parent>cm:content</parent>
         <mandatory-aspects>
             <aspect>myCustom:productContentAspect</aspect>
           </mandatory-aspects>
      </type>
   </types>
   
   <aspects>
   
   <!– Generic Aspect –>
   <aspect name="myCustom:aspect">
   </aspect>
   
   <!– Product Content Aspect –>
   <aspect name="myCustom:productContentAspect">
      <parent>myCustom:aspect</parent>
      <properties>
         <property name="myCustom:annoEsercizio">
            <type>d:int</type>
            <mandatory>false</mandatory>
         </property>
         </properties>      
   </aspect>
   </aspects>


And here is the share-config-custom:

<share-config>
   
   <config evaluator="string-compare" condition="DocumentLibrary">
   <aspects>   
      <visible>
         <aspect name="myCustom:productContentAspect"/>
      </visible>
   </aspects>
   
   <types>
      <type name="cm:content">
         <subtype name="myCustom:productContentType"/>
      </type>
   </types>   
   </config>
   
   <config evaluator="aspect" condition="myCustom:productContentAspect">
      <forms>
        <form>
        <field-visibility>
            <show id="myCustom:annoEsercizio"/>                     
        </field-visibility>
         
   <appearance>
   <set id="myCustom_productContentPropertySet" appearance="bordered-panel" label-id="aspect.myCustom_productContentAspect"/>
                     
        <field id="myCustom:annoEsercizio" set="myCustom_productContentPropertySet" label-id="prop.myCustom_annoEsercizio">
   <control template="/org/alfresco/components/form/controls/number.ftl" />
   </field>

        </appearance>          
        </form>  
   </forms>
   </config>   
   
</share-config>

Outcomes