cancel
Showing results for 
Search instead for 
Did you mean: 

Add custom aspect as a rule

dave984
Champ in-the-making
Champ in-the-making
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>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
4 REPLIES 4

rjohnson
Star Contributor
Star Contributor
You seem to have made your aspect mandatory. This means it always gets added automatically to documents of type myCustom:docContentType when they are created. If thats what you want you should not need a rule, but you will get the aspects on all documents of type myCustom:docContentType regardless of the folder they are in.

If you want the aspect only on documents in the folder, do not make it a mandatory aspect.

I'm not immediately sure why it isn't on your list but you have not given your aspect a title so it is possible that Alfresco just won't list it until you do. Your model definintion should look like

   <aspects>      <aspect name="???????">         <title>Description you want to display here</title>         <properties>                        …….                        </properties>                 </aspect>        </aspects>‍‍‍‍‍‍‍‍‍‍


Bob Johnson

Dear Bob,

I am new in alfresco I have alfresco 4.2.f I tried to add new aspect but I can't success please please can you help me.

I'm on 4.2e but it won't have changed much. Whats your problem?

dave984
Champ in-the-making
Champ in-the-making
BOB, you're simply great!!!!